Skip to main content

Channelstream

Build Status

This is a websocket-based real-time communication server, your applications communicate with it via simple JSON REST API.

Visit http://channelstream.org for more information.

Installation and Setup

Obtain source from github and do:

YOUR_PYTHON_ENV/bin/pip install channelstream

Generate new configuration:

YOUR_PYTHON_ENV/bin/channelstream_utils make_config -o config.ini

Start the server:

YOUR_PYTHON_ENV/bin/channelstream -i config.ini

Demos

Demo applications live in https://github.com/Channelstream/channelstream_demos repository.

They show common patterns used in real-time applications.

Security and communication model

Channelstream provides API explorer that you can use to interact with various endpoints, it is available by default under http://127.0.0.1:8000/api-explorer.

To send information client interacts only with your normal www application. Your app handled authentication and processing messages from client, then passed them as signed message to channelstream server for broadcast.

websocket client -> webapp (security and transformation happens here) -> REST call to socket server -> broadcast to other clients

This model is easy to implement, secure, easy to scale and allows all kind of languages/apps/work queues to interact with socket server.

All messages need to be signed with a HMAC of destination endpoint ::

import requests
from itsdangerous import TimestampSigner
signer = TimestampSigner(SERVER_SECRET)
sig_for_server = signer.sign('/connect')
secret_headers = {'x-channelstream-secret': sig_for_server,
                  'Content-Type': 'application/json'}
response = requests.post(url, data=json.dumps(payload),
                         headers=secret_headers).json()

Data format and endpoints

Please consult API Explorer (http://127.0.0.1:8000/api-explorer) for in depth information about endpoints.

Some examples:

  • /connect POST connects users to the server
  • /subscribe POST Subscribes connection to new channels
  • /unsubscribe POST Removes connection from channels
  • /user_state POST set the state of specific user
  • /message POST Send message to channels and/or users
  • /message DELETE Delete message from history and emit changes
  • /message PATCH Edit existing message in history and emit changes
  • /channel_config POST Set channel configuration
  • /info POST Returns channel information

Client API

  • /ws GET Handles websocket connections
  • /listen GET Handles long polling connections
  • /disconnect GET Permanently remove connection from server
  • /disconnect POST Permanently remove connection from server

Admin API

  • /admin/admin.json GET Return server information in json format for admin panel purposes
  • /admin/admin.json POST Return server information in json format for admin panel purposes

Responses to js client

Responses to client are in form of list containing objects:

examples:

new message ::

{
"date": "2011-09-15T11:36:18.471862",
"message": MSG_PAYLOAD,
"type": "message",
"user": "NAME_OF_POSTER",
"channel": "CHAN_NAME"
}

presence info ::

{
"date": "2011-09-15T11:43:47.434905",
"message": {"action":"joined/parted"},
"type": "presence",
"user": "NAME_OF_POSTER",
"channel": "CHAN_NAME"
}

Currently following message types are emited: message, message:edit, message:delete, presence, user_state_change.

Release files for channelstream 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for channelstream 0.7.1
File Size Uploaded
channelstream-0.7.1.tar.gz 211.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for channelstream 0.7.1
File Interpreter ABI Platform
channelstream-0.7.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 429.8 kB

Release files / channelstream-0.7.1.tar.gz

Download URL channelstream-0.7.1.tar.gz
Size 211.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fbd82819ea58812ac92d68e9df9f7290f8a51846f3566876a1ad44b51b1d52ea
BLAKE2b-256 checksum
How to use checksums
50fcf1a0dca94ea2fd05353e83ffed73009b564f3ec47b5ab0f6ef851844c5cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

Release files / channelstream-0.7.1-py2.py3-none-any.whl

Download URL channelstream-0.7.1-py2.py3-none-any.whl
Size 218.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
550554349355cf4de305c8340038b99a6a8893bb2dfa02a5d756bfc4a5ebb358
BLAKE2b-256 checksum
How to use checksums
e25e04113669d150fa173571a0e5b1863e5c0fffc2da7590e4a05b12017f5d75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files

0.7.0

2 release files

0.6.11

2 release files

0.6.9

2 release files

0.6.0

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4

1 release file

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page