Deployments: loading...

Websocket Hooks


We are happy to introduce a brand new way of sending data to any Hook service endpoint, Websockets!

This new functionality enables a bridge between Websocket connections and Webhook microservices.

Through a standard ws:// connection, you can now connect to any existing hook.io microservice though Websockets.

hook.io will hold the Websocket connection, attempting to parse any incoming messages as JSON and forward them to an existing hook service.

If a string or non-JSON message is received, hook.io will simply pass the data to the hook 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 Websockets to send and receive data.

Example

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


Simple as pie!

Binary Data Support / Websocket Transform Streams

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 transforms of binary data using the regular HTTP API:

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

If you are interested in helping with this 100% open-source hook.io project, come join the discussion at: https://github.com/bigcompany/hook.io

Go Websockets!