Skip to content

Connecting Websockets

Follow the below steps to establish a connection with websocket.

Using Python SDK

If you are using our Python SDK, you can use the built-in pocketfulSocket class.

First import the pocketfulwebsocket library:

from pocketfulwebsocket import pocketfulSocket

Then create an instance:

pocket_ws = pocketfulSocket(clientId, access_token)

Then call the method run_socket to establish a connection:

ws_status = pocket_ws.run_socket()

Using Standard WebSockets

Since our system uses standard WebSocket protocol, you can use any WebSocket client library in your preferred language (e.g., ws for Node.js, gorilla/websocket for Go).

Base WebSocket URL: wss://algo.pocketful.in/api/v1/ws (Note: Ensure you include your access token in the connection handshake or subsequent authentication message).

After completing the connection, you can subscribe to market data or order updates.