---
schema_version: "1"
id: 66fe0b4067ed4266913ece7c24f89ab40e0835bee3451d5ee81415cbda44535e
title: WebSockets メッセージング操作
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/websockets-connector/latest/websockets-connector-messaging-operations.md
canonical_url: https://docs.mulesoft.com/jp/websockets-connector/latest/websockets-connector-messaging-operations
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c19f805aad5656228ffbe5ad688fbecdf3cac3344cfd20c5206592c4b0d05023
description: MuleSoft Documentation Site
release: "1.0"
latest: true
---
# WebSockets メッセージング操作

## [](#send-操作)Send 操作

Send 操作により、接続が確立された後にそのソケット ID によって識別される WebSocket を通じてメッセージを送信できます。この操作は、インバウンドとアウトバウンドの両方の WebSocket インスタンスで使用できます。

```xml
    <flow name="sayHello">
      <websocket:open-outbound-socket
        path="/chat/hello"
        config-ref="ws"
        target="socketId"
        targetValue="#[attributes.socketId]"/>
      <websocket:send socketId="#[vars.socketId]" config-ref="ws">
        <websocket:content>'Good morning!'</websocket:content>
      </websocket:send>
    </flow>

    <flow name="sayHelloBack">
        <websocket:inbound-listener
            path="/chat/hello"
            config-ref="ws"
            outputMimeType="text/plain" />
        <websocket:send socketId="#[attributes.socketId]" config-ref="ws">
            <websocket:content>#['Good morning ' ++ attributes.socketId ++ '!']</websocket:content>
        </websocket:send>
    </flow>
```

## [](#broadcast-操作)Broadcast 操作

Broadcast 操作はメッセージをソケットのグループに送信します。メッセージをブロードキャストできるソケットのグループを選択する手順は、次のとおりです。

- 特定のグループをサブスクライブする
- 特定のパスに接続する
- 特定の種別にする (INBOUND または OUTBOUND)

種別およびグループパラメーターは連携して加法的に機能します。省略することも個別に使用することもできますが、一緒に使用すると 2 つのレベルの絞り込みとして動作します。

```xml
<!-- Send to all INBOUND sockets connected to the /quotes endpoint, in the MARVEL and DC groups -->
<websocket:broadcast
    doc:name="Broadcast"
    socketType="INBOUND"
    config-ref="WebSockets_Config"
    path="/quotes">
    <websocket:groups >
        <websocket:group value=" #[['MARVEL', 'DC']]" />
    </websocket:groups>
</websocket:broadcast>
```

### [](#出力)出力

Broadcast 操作の出力は void です。

## [](#関連情報)関連情報

- [MuleSoft ヘルプセンター](https://help.mulesoft.com)
- [WebSockets Connector の概要](https://docs.mulesoft.com/jp/websockets-connector/latest/)
- [グループの管理](https://docs.mulesoft.com/jp/websockets-connector/latest/websockets-connector-managing-groups)
- [Connector Configuration (コネクタ設定)](https://docs.mulesoft.com/jp/websockets-connector/latest/websockets-connector-config-topics)