soul

Websocket Examples

Soul realtime right now only support rows changes.

Setup Environment

To follow the below examples we need to download a sample database, install Soul CLI and also a websocket client to test. (Please note that you can use any websocket client you want, e.g. Postman, Insomnia, etc.)

Download Sample Database

wget https://raw.githubusercontent.com/lerocha/chinook-database/master/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite # Download sample sqlite database

Install Websocket client

npm i -g wscat # Install websocket client

Using Soul CLI

npm install -g soul-cli
soul -d ./Chinook_Sqlite.sqlite -p 8000
Or Using Local Development ```bash git clone https://github.com/thevahidal/soul # Clone project npm install # Install dependencies npm link # might need `sudo` soul -d ./Chinook_Sqlite.sqlite -p 8000 ```

Namespaces

  1. /ws/tables Examples for Rows websockets

Authentication

When Soul is running with -a (auth mode), WebSocket connections require the same accessToken cookie used by the REST API, and are subject to the same per-table read permission checks. Connect with the cookie set (e.g. wscat --header "Cookie: accessToken=<token>" or a browser session that already has it) – connections without a valid, authorized token are closed with an error message.