public class WebSocketOperations extends Object
| Constructor and Description |
|---|
WebSocketOperations() |
| Modifier and Type | Method and Description |
|---|---|
void |
broadcast(org.mule.runtime.api.metadata.TypedValue<InputStream> content,
FluxCapacitor fluxCapacitor,
String path,
BroadcastSocketType socketType,
List<String> groups,
org.mule.runtime.core.api.retry.policy.RetryPolicyTemplate retryPolicyTemplate,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<List<BroadcastFailure>,Void> completionCallback)
Sends the given
content to all the active WebSockets that match the path, socketType and
groups criteria. |
void |
bulkCloseSockets(FluxCapacitor fluxCapacitor,
BroadcastSocketType socketType,
List<String> groups,
org.mule.runtime.http.api.ws.WebSocketCloseCode closeCode,
String reason,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<Void,Void> completionCallback) |
void |
closeSocket(String socketId,
org.mule.runtime.http.api.ws.WebSocketCloseCode closeCode,
String reason,
FluxCapacitor fluxCapacitor,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<Void,Void> callback)
Closes the
socket |
void |
openOutboundSocket(String socketId,
UriSettings uriSettings,
WebSocketRequestBuilder connectionRequestBuilder,
List<String> defaultGroups,
WebSocketsConnector config,
FluxCapacitor fluxCapacitor,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<String,WebSocketAttributes> callback)
Opens a new outbound socket
|
void |
send(String socketId,
org.mule.runtime.api.metadata.TypedValue<InputStream> content,
FluxCapacitor fluxCapacitor,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<Void,Void> callback,
org.mule.runtime.core.api.retry.policy.RetryPolicyTemplate retryPolicyTemplate)
Sends the given
content through the given socket |
void |
subscribeGroups(FluxCapacitor fluxCapacitor,
String socketId,
List<String> groups)
Subscribes the socket of the given
socketId to the given groups. |
void |
unsubscribeGroups(FluxCapacitor fluxCapacitor,
String socketId,
List<String> groups)
Unsubscribes the socket of the given
socketId from the given groups. |
@Throws(value=DefaultErrorProvider.class) public void send(String socketId, @Content org.mule.runtime.api.metadata.TypedValue<InputStream> content, @Connection FluxCapacitor fluxCapacitor, org.mule.runtime.extension.api.runtime.process.CompletionCallback<Void,Void> callback, org.mule.runtime.core.api.retry.policy.RetryPolicyTemplate retryPolicyTemplate)
content through the given socketsocketId - the id of the socket through which data is to be sentcontent - the content to be sentfluxCapacitor - the acting flux capacitorcallback - completion callbackretryPolicyTemplate - the reconnection policy@Throws(value=BroadcastErrorProvider.class) @Execution(value=BLOCKING) public void broadcast(@Content org.mule.runtime.api.metadata.TypedValue<InputStream> content, @Connection FluxCapacitor fluxCapacitor, String path, @Optional(defaultValue="ALL") BroadcastSocketType socketType, @Optional @NullSafe List<String> groups, org.mule.runtime.core.api.retry.policy.RetryPolicyTemplate retryPolicyTemplate, org.mule.runtime.extension.api.runtime.process.CompletionCallback<List<BroadcastFailure>,Void> completionCallback)
content to all the active WebSockets that match the path, socketType and
groups criteria. In the case of the path, the base path configured in the config will not be considered as you
may be targeting both inbound and outbound sockets.
The message will be send to all the matching sockets, even though it's possible that delivery to some of them fail.
The operation will return a list of BroadcastFailure containing details of each of the failures. If none fail, an
empty list is returned
content - the content to be sentfluxCapacitor - the acting FluxCapacitorpath - the path of the sockets to be matchedsocketType - the type of sockets to be matchedgroups - matches sockets that belong to any of these groupscompletionCallback - the CompletionCallbackretryPolicyTemplate - the reconnection policy@Throws(value=BroadcastErrorProvider.class) @Execution(value=BLOCKING) public void bulkCloseSockets(@Connection FluxCapacitor fluxCapacitor, @Optional(defaultValue="ALL") BroadcastSocketType socketType, @Optional @NullSafe List<String> groups, @Optional(defaultValue="NORMAL_CLOSURE") org.mule.runtime.http.api.ws.WebSocketCloseCode closeCode, @Optional(defaultValue="") String reason, org.mule.runtime.extension.api.runtime.process.CompletionCallback<Void,Void> completionCallback)
@MediaType(value="text/plain") @Throws(value=OpenOutboundSocketErrorTypeProvider.class) public void openOutboundSocket(@Optional String socketId, @Placement(order=1) @ParameterGroup(name="URI Settings") UriSettings uriSettings, @Placement(order=2) @ParameterGroup(name="Connection Request") WebSocketRequestBuilder connectionRequestBuilder, @Optional @NullSafe List<String> defaultGroups, @Config WebSocketsConnector config, @Connection FluxCapacitor fluxCapacitor, org.mule.runtime.extension.api.runtime.process.CompletionCallback<String,WebSocketAttributes> callback)
uriSettings - The path/url to connect toconnectionRequestBuilder - the request builderdefaultGroups - the groups to which the socket should be initially subscribedconfig - the connector's configfluxCapacitor - the acting flux capacitorcallback - the completion callback@Throws(value=DefaultErrorProvider.class) public void closeSocket(String socketId, @Optional(defaultValue="NORMAL_CLOSURE") org.mule.runtime.http.api.ws.WebSocketCloseCode closeCode, @Optional(defaultValue="") String reason, @Connection FluxCapacitor fluxCapacitor, org.mule.runtime.extension.api.runtime.process.CompletionCallback<Void,Void> callback)
socketsocketId - the id of the socket to be closedcloseCode - the close codereason - the closing reason phrasefluxCapacitor - the acting flux capacitorcallback - the completion callback@Throws(value=GroupSubscriptionErrorProvider.class) public void subscribeGroups(@Connection FluxCapacitor fluxCapacitor, String socketId, List<String> groups) throws Exception
socketId to the given groups.
This operation can be used on the same socket as many times as necessary, each use being additive over previous ones.
Repeated groups will be ignored.
Works for both types INBOUND and OUTBOUND sockets.
fluxCapacitor - the FluxCapacitorsocketId - the id of the socket to be subscribedgroups - the groups that the socket will be subscribed toException@Throws(value=GroupSubscriptionErrorProvider.class) public void unsubscribeGroups(@Connection FluxCapacitor fluxCapacitor, String socketId, List<String> groups) throws Exception
socketId from the given groups.
This operation can be used on the same socket as many times as necessary, each use being additive over previous ones.
Works for both types INBOUND and OUTBOUND sockets.
fluxCapacitor - the FluxCapacitorsocketId - the id of the socket to be subscribedgroups - the groups that the socket will be unsubscribed fromExceptionCopyright © 2024 MuleSoft, Inc.. All rights reserved.