BATC Streamer - Chat Engine

Area for discussing streaming over the Internet, especially as it relates to ATV
Forum rules
This forum is run by the BATC (British Amateur Television Club), it is service made freely available to all interested parties, please do not abuse this privilege.

Thank you
M0DTS
Posts: 653
Joined: Sun Feb 24, 2008 9:03 pm

Re: BATC Streamer - Chat Engine

Post by M0DTS » Sun May 15, 2022 2:57 pm

Here's the basic python script to receive messages from a certain stream using python.
This is not yet an OBS script, I'll get there later but gives the very simple interface to the messages needed.

I have assumed this is intended for a windows system with OBS but i may be mistaken...
i also believe you need python v3.6 for OBS, dont think it works with the latest version.

You need to install socketio library for python with this command at windows command prompt:
python -m pip install python-engineio==3.14.2 python-socketio==4.6.0

(the default library does not connect for some reason)
Change room=gb3km to whatever stream you like, note lower case.

Then here is the example script to connect and await messages:

Code: Select all


import socketio
import time

sio = socketio.Client()

@sio.on('message')
def message(data):
    print('received message',data)   #example message format in dict: {'time': '2022-05-15T14:36:19.517Z', 'name': 'M0DTS', 'message': 'test'}

sio.connect("https://batc.org.uk/?room=gb3km",{},transports=None,socketio_path='live-chat/socket.io')
sio.wait()

Example output:

Code: Select all

C:\Users\rob>python c:\python_code\chat.py
received message {'time': '2022-05-15T14:52:48.626Z', 'name': 'M0DTS', 'message': 'did we try 3cm before?'}

Post Reply

Return to “Streaming”