public final class WebSocketMethods extends Object
A TORO utility class for WebSocket Messages related operations./p>
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. Makes it easy to send Messages via WebSocket.
Modifier and Type | Method and Description |
---|---|
static void |
sendWSMessage(String destination,
Message<?> message)
Send a Web Socket Message.
|
static void |
sendWSMessage(String destination,
Object message)
Send a Web Socket Message.
|
static void |
sendWSMessage(String destination,
Object payload,
Map<String,Object> headers)
Send a Web Socket Message.
|
static void |
sendWSMessage(String destination,
Object payload,
Map<String,Object> headers,
MessagePostProcessor postProcessor)
Send a Web Socket Message.
|
static void |
sendWSMessage(String destination,
Object payload,
MessagePostProcessor postProcessor)
Send a Web Socket Message.
|
static void |
sendWSMessage(String destination,
String user,
Object payload)
Send a Web Socket Message.
|
static void |
sendWSMessage(String destination,
String user,
Object payload,
Map<String,Object> headers)
Send a Web Socket Message.
|
static void |
sendWSMessage(String destination,
String user,
Object payload,
Map<String,Object> headers,
MessagePostProcessor postProcessor)
Send a Web Socket Message.
|
static void |
sendWSMessage(String destination,
String user,
Object payload,
MessagePostProcessor postProcessor)
Send a Web Socket Message.
|
public static void sendWSMessage(String destination, Object message)
Send a Web Socket Message.
Example usage:
String destination = '/topic/greetings' destination.sendWSMessage( 'This is a sample message' )
destination
- The destination where the message will be sentmessage
- The message to be sent.public static void sendWSMessage(String destination, Object payload, Map<String,Object> headers) throws MessagingException
Send a Web Socket Message.
Example usage:
String destination = '/topic/greetings' def headers = [ username : 'john', password : '1234abc' ] destination.sendWSMessage( 'This is a sample message' , headers )
destination
- The destination where the message will be sentpayload
- The message to be sent.headers
- The headers to be included in the requestMessagingException
public static void sendWSMessage(String destination, Message<?> message) throws MessagingException
Send a Web Socket Message.
Example usage:
String destination = '/topic/greetings' Message message = new Message(); destination.sendWSMessage( message , headers )
destination
- The destination where the message will be sentmessage
- The message to be sent.MessagingException
public static void sendWSMessage(String destination, Object payload, MessagePostProcessor postProcessor) throws MessagingException
Send a Web Socket Message.
Example usage:
String destination = '/topic/greetings' MessageProcessor processor = { message -> 'This is a sample message' return message } destination.sendWSMessage( payload ,processor )
destination
- The destination where the message will be sentpayload
- The message to be sent.postProcessor
- MessagePostProcessor objectMessagingException
public static void sendWSMessage(String destination, Object payload, Map<String,Object> headers, MessagePostProcessor postProcessor) throws MessagingException
Send a Web Socket Message.
Example usage:
String destination = '/topic/greetings' def headers = [ username : 'john', password : '1234abc' ] MessageProcessor processor = { message -> 'This is a sample message' return message } destination.sendWSMessage( payload , headers. processor )
destination
- The destination where the message will be sentpayload
- The message to be sent.headers
- The headers to be included in the requestpostProcessor
- MessagePostProcessor objectMessagingException
public static void sendWSMessage(String destination, String user, Object payload) throws MessagingException
Send a Web Socket Message.
Example usage:
String destination = '/topic/greetings' destination.sendWSMessage( 'john', 'this is a sample message' )
destination
- The destination where the message will be sentpayload
- The message to be sent.user
- The user to send the message toMessagingException
public static void sendWSMessage(String destination, String user, Object payload, Map<String,Object> headers) throws MessagingException
Send a Web Socket Message.
Example usage:
String destination = '/topic/greetings' def headers = [ username : 'john', password : '1234abc' ] destination.sendWSMessage( 'john', 'this is a sample message', headers )
destination
- The destination where the message will be sentpayload
- The message to be sent.user
- The user to send the message toMessagingException
public static void sendWSMessage(String destination, String user, Object payload, MessagePostProcessor postProcessor) throws MessagingException
Send a Web Socket Message.
Example usage:
String destination = '/topic/greetings' MessageProcessor processor = { message -> 'This is a sample message' return message } destination.sendWSMessage( 'jane', payload , processor )
destination
- The destination where the message will be sentuser
- String user receiverpayload
- The message to be sent.postProcessor
- MessagePostProcessor objectMessagingException
public static void sendWSMessage(String destination, String user, Object payload, Map<String,Object> headers, MessagePostProcessor postProcessor) throws MessagingException
Send a Web Socket Message.
Example usage:
String destination = '/topic/greetings' def headers = [ username : 'john', password : '1234abc' ] MessageProcessor processor = { message -> 'This is a sample message' return message } destination.sendWSMessage( 'john', payload , headers, processor )
destination
- The destination where the message will be sentuser
- String user receiverpayload
- The message to be sent.headers
- The headers to be included in the requestpostProcessor
- MessagePostProcessor objectMessagingException
Copyright © 2019. All rights reserved.