Posts

Python Receiving data and send data

Flask-SocketIO  gives Flask applications access to low latency bi-directional communications between the clients and the server. The client-side application can use any of the  SocketIO  official clients libraries in Javascript, C++, Java and Swift, or any compatible client to establish a permanent connection to the server. Installation You can install this package in the usual way using  pip : pip install flask - socketio from flask import Flask, render_template from flask_socketio import SocketIO app = Flask(__name__) app.config['SECRET_KEY'] = 'secret!' socketio = SocketIO(app) from socketIO_client import SocketIO as client_socketio, BaseNamespace my_client = client_socketio('184.72.95.87',3000) str="" @socketio.on('chat message') def handle_message(message): print('received message: ' + message) my_client.emit('chat message', str) print(str) def doSomething(data): print data print "Hallo...
Recent posts