Receive Messages from Aleph

Receive Messages from the aleph server with WebSockets.

Usage

// Websocket URL:
// "wss://<TARGET SERVER>/api/ws0/messages?
// query_1=value&query_2=value"

// Example url:
// "wss://api2.aleph.im/api/ws0/messages?
// msgType=POST&contentTypes=chat"

const url = 'wss://api2.aleph.im/api/ws0/messages'

const connection = new WebSocket(url) 

connection.onmessage = (e) => { 
  console.log(JSON.parse(e.data))
}

Only one msgType can be queried at a time. All other query parameters are comma-separated strings if multiple values are passed.

If multiple values are passed for one query parameter, messages that match at least one of the values will be returned.

If multiple query parameters are passed, messages that match ALL conditions will be returned.

Query parameters

Last updated