Skip to content

Home

Development

IDEs

JAR services

API Explorer

WebSocketFunctions

The WebSocket class contains functions for sending web socket messages in Gloop and Groovy. The snippet below demonstrates how the functions in this class may be used:

Sample service showing how to use the `WebSocket` functions

1
2
3
4
5
6
7
8
// Send a message to the topic
'/topic/dogs'.sendWSMessage("Who's a good boy?")

// Create a map for headers we want to send in the web socket message
def headers = ['username': 'johndoe', 'password': 'pa\$\$w0rd']

// Send a message with headers
'/topic/dogs'.sendWSMessage("Who's a good boy?", headers)

Learn more about WebSockets!

Check out the examples package's short guide on WebSockets to learn the basics and see examples.