(Example)
(Example)
Line 3: Line 3:
  
 
== Example ==
 
== Example ==
```
+
<pre>
 
import socketio
 
import socketio
  
Line 23: Line 23:
 
sio.connect(url='https://api.brandmeister.network', socketio_path="/lh/socket.io", transports="websocket")
 
sio.connect(url='https://api.brandmeister.network', socketio_path="/lh/socket.io", transports="websocket")
 
sio.wait()
 
sio.wait()
```
+
</pre>

Revision as of 10:40, 16 March 2022

Requirements

pip install socketIO-client

Example

import socketio

sio = socketio.Client()

@sio.event
def connect():
    print('connected to server')

@sio.event
def disconnect():
    print('disconnected from server')

@sio.on("mqtt")
def on_mqtt(data):
    print (data)
    return

sio.connect(url='https://api.brandmeister.network', socketio_path="/lh/socket.io", transports="websocket")
sio.wait()

Requirements[edit]

pip install socketIO-client

Example[edit]

import socketio

sio = socketio.Client()

@sio.event
def connect():
    print('connected to server')

@sio.event
def disconnect():
    print('disconnected from server')

@sio.on("mqtt")
def on_mqtt(data):
    print (data)
    return

sio.connect(url='https://api.brandmeister.network', socketio_path="/lh/socket.io", transports="websocket")
sio.wait()