Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket.on('event', (...) {...}) is called twice. #18

Closed
madqueendany opened this issue Mar 20, 2019 · 3 comments
Closed

socket.on('event', (...) {...}) is called twice. #18

madqueendany opened this issue Mar 20, 2019 · 3 comments

Comments

@madqueendany
Copy link

So I have my listeners on initState...

socket.on('synchronizedata', (packet) {
      print('packet of type ${packet['packetKind']}!-> $packet');

      _syncMessages(context, _message);
    });

but when the server emits synchronizedata, the code above is fired twice. Any thoughts? Initially, I have them on the build method, but after reading [issue #15], I placed them into initState.

Any thoughts?

@madqueendany
Copy link
Author

Hmm... I might have solved this accidentally.

For some reason I removed socket_io import and the calls are not duplicated anymore. Will wait for a couple more days to see if the issue persists.

@madqueendany
Copy link
Author

Issue no longer encountered (weirdly enough)... Closing!

@JonataCSantos
Copy link

@madqueendany Hi, I'm having the same problem but I only got this import:

import "package:socket_io_client/socket_io_client.dart" as IO;

Did you use something different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants