Skip to content

Websockets

Clement Rugwiro edited this page Apr 22, 2019 · 2 revisions

Websockets

A WebSocket is an HTTP upgrade connection between a server and a client that uses a single TCP connection to allow bi-directional communication between the server and the client.

In Kazoo, Websockets are implemented through blackhole on port 5555. Check kazoo/websockets and kazoo/blackhole documentation for more details on this.

In Kazoo_websockets.py This is a template to setting up websockets in kazoo. We use the Asynchronous method hello() to allow messages from multiple bindings to be handled in a single process.

websockets_Alchemy.py

By using the same connection, we subscribe to multiple bindings CHANNEL_DESTROY, CHANNEL_CREATE, object.doc_created.user, object.doc_create.account and object.doc_created.device and get notified anytime anything changes to these specific objects and events. These bindings are arbitrary, you can subscribe to the bindings of your choice. check out get_bindings method in kazoo_put

After parsing the data, we call insert_data imported from data_alchemy to store the data in the database right away.

Clone this wiki locally