Without any answer on socketio.emit
See original GitHub issueWe have a python code:
vToken = GetToken()
ListenPort = 'http://180.13.1.245:3013'
sio = socketio.AsyncClient()
loop = asyncio.get_event_loop()
start_timer = None
async def send_ping():
global start_timer
start_timer = time.time()
await sio.emit('ping_from_client')
@sio.event
async def connect():
print('connected to server')
await send_ping()
@sio.event
async def pong_from_server():
global start_timer
latency = time.time() - start_timer
print('latency is {0:.2f} ms'.format(latency * 1000))
await sio.sleep(1)
await send_ping()
async def start_server():
await sio.connect(ListenPort)
await sio.emit('report-client-register', data={'token': vToken, 'channelRole': 'client'})
sio.on('report-client-rejection', {'token': vToken})
sio.on('report-client-rooms', {'token': vToken})
sio.on('push-broadcast-register', {'token': vToken})
if __name__ == '__main__':
loop.run_until_complete(start_server())
and Log file:
08/24/2020 02:50:17 PM Starting new HTTPS connection (1): cajeros.frontusuarios_st.monitorizacion.santander.pre.corp:443
08/24/2020 02:50:17 PM https://cajeros.frontusuarios_st.monitorizacion.santander.pre.corp:443 "POST /ws/geplus/v1/d/login HTTP/1.1" 200 249
08/24/2020 02:50:17 PM Using selector: SelectSelector
08/24/2020 02:50:17 PM Attempting polling connection to http://180.13.1.245:3013/socket.io/?transport=polling&EIO=3
08/24/2020 02:50:17 PM Polling connection accepted with {'sid': 'vPRGLKw5nI-EkW7uAAAD', 'upgrades': ['websocket'], 'pingInterval': 25000, 'pingTimeout': 5000}
08/24/2020 02:50:17 PM Engine.IO connection established
08/24/2020 02:50:17 PM Received packet MESSAGE data 0
08/24/2020 02:50:17 PM Attempting WebSocket upgrade to ws://180.13.1.245:3013/socket.io/?transport=websocket&EIO=3
08/24/2020 02:50:17 PM Namespace / is connected
08/24/2020 02:50:17 PM Emitting event "ping_from_client" [/]
08/24/2020 02:50:17 PM Sending packet MESSAGE data 2["ping_from_client"]
08/24/2020 02:50:17 PM WebSocket upgrade was successful
08/24/2020 02:50:17 PM Emitting event "report-client-register" [/]
08/24/2020 02:50:17 PM Sending packet MESSAGE data 2["report-client-register",{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuaWNrIjoiQWxiZXJ0byIsImlhdCI6MTU5ODI3MzQ4NSwiZXhwIjoxNTk4MzU5ODg1fQ.7obwM0R64eQdAwWUTQFyLitEHwwv7XXzzn4SvR0hgUc","channelRole":"client"}]
08/24/2020 02:50:17 PM Emitting event "report-client-register" [/]
08/24/2020 02:50:17 PM Sending packet MESSAGE data 2["report-client-register",{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuaWNrIjoiQWxiZXJ0byIsImlhdCI6MTU5ODI3MzQ4NSwiZXhwIjoxNTk4MzU5ODg1fQ.7obwM0R64eQdAwWUTQFyLitEHwwv7XXzzn4SvR0hgUc"}]
08/24/2020 02:50:17 PM Sending packet PING data None
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Emitting events | Socket.IO
The Socket.IO API is inspired from the Node.js EventEmitter, which means you can emit events on one side and register listeners on the...
Read more >How to send response back to client using socket.io?
emit call from client to server in response i want to have filename to the client that is not happening with below code...
Read more >Getting Started — Flask-SocketIO documentation
SocketIO event handlers defined as shown in the previous section can send reply messages to the connected client using the send() and emit()...
Read more >Socket.IO, React and Node.js: Going Real-Time
It takes socket as an argument, which is nothing more than the communication channel between the client and the server: const getApiAndEmit = ......
Read more >Everything you need to know about Socket.IO - Ably Realtime
With sockets, when the server receives a new message it will send it to the client and notify them, bypassing the need to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Events do not have responses in Socket.IO. If the server is configured to send ACK packets, then you can add a callback to your emit, which will be called when the server acknowledges the event. The
call()
function combines the emit and the callback and makes it look like a single thing, so maybe that’s what you are looking for.Work fine. Thanks.