Skip to content

Home

Development

IDEs

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

WebSocketMethods

The WebSocketMethods class contains one-liners for sending web socket messages in Gloop and Groovy. The snippet below demonstrates how the methods in this class may be used:

Sample Gloop service showing how to use the `WebSocketMethods` one-liners

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.