python - get current connection in flask socket.io -


i want make multiple emitting individual socket connection using flask's socket.io extension.

from flask.ext.socketio import socketio, emit, join_room, leave_room   # creating flask app , io...  @io.on("/saysomething") def saying():   emit("said", "hello")   saying2()  def saying2():   # ...   # doing long , important   # ...   emit("said", "and how you?") 

i not know connection saying2 emitting to. should pass current connection saying2 method? how can achieve goal?

in example, saying2() emitting client sent /saysomething event. based on concept similar request contexts in standard flask.

the emit function has 2 optional arguments send other clients:

  • broadcast=true send connected clients, including client sent /saysomething event.
  • room=<room-name> send clients attached given room. if want address individual clients, put each client in different room , target desired room.

Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -