Skip to content

Emit recieved on the client side only after the server-side emit function returns #2

Open
@ahmedtalhakhan

Description

@ahmedtalhakhan

I tried to use django-socketio but faced an issue. When an event is emitted from the client-side, it is immediately received on the server side. However, when the server-side emits the event, it is only received when the sending function from the server-side code returns. I tried by sending multiple emits and then returning. Here is the sample code

Here is my events.py

@Namespace('/test')
class TestNs(BaseNamespace):
    def on_test(self,msg):
        for i in range(5):
            self.emit('test','1')
            time.sleep(1)

        time.sleep(10)
        self.emit('test','atlast')

And here is what the client looks like

var socket = io.connect('/test');
socket.emit('test','Send to server');
socket.on('test', function(data){console.log("Got back " + data(})

Client-side shows data when the sender in server-side returns. Am I missing something or is this a buffering issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions