Deployments: loading...

Websockets

All services on hook.io have the ability to receive JSON data over a Websocket connection. hook.io will hold the Websocket connection, attempting to parse any incoming messages as JSON and forward them to the hook microservice. If a string or non-JSON message is received, hook.io will simply pass the data to the service as hook.params.body Any Websocket client will work, including the browser.

Below is an example of using the wscat tool to connect to a hook.io service over a Websocket connection to send and receive data.

Example

wscat -c ws://hook.io/examples/echo



Currently, hook.io Websockets can only receive data as text or JSON messages. In the near future, we will most likely add support for streaming binary data over Websocket with the ability to perform transforms on the data stream. Remember, you can still perform streaming transformations of binary data using the regular HTTP API:

echo "foo" | curl --header "content-type: application/octet-stream" --data-binary @- http://hook.io/examples/javascript-stream-transform