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 emit not passing data for some seconds #71

Open
devalvitec opened this issue Oct 19, 2023 · 3 comments
Open

Socket emit not passing data for some seconds #71

devalvitec opened this issue Oct 19, 2023 · 3 comments

Comments

@devalvitec
Copy link

Hi ,

I am in the middle of game development and my game emits data for 30-40 seconds and then it pauses for some reason for almost 5-10 seconds and then whatever data I have emitted in those 5-10 seconds it's received all together in one go.

what might be the reason for that,

We have checked in the server with log and timestamp they says that Unity's socket call is not receiving to the server and as they receive all call at the same time server provide a response as one go.

any suggestion here on what might be the problem?

@itisnajim
Copy link
Owner

@64jcl
Copy link

64jcl commented Nov 30, 2023

I spent a couple of hours not understanding why I had similar problems and it boiled down to the fact that something silences all exceptions in socket.On() calls and furthermore you cannot reach the main thread objects through it - so you cant trigger anything in Unity directly from within the socket.On() function handler ! You have to store your response in a variable which you then read from e.g. OnUpdate to actually handle the message.

@itisnajim
Copy link
Owner

I spent a couple of hours not understanding why I had similar problems and it boiled down to the fact that something silences all exceptions in socket.On() calls and furthermore you cannot reach the main thread objects through it - so you cant trigger anything in Unity directly from within the socket.On() function handler ! You have to store your response in a variable which you then read from e.g. OnUpdate to actually handle the message.

u have to use socket.OnUnityThread instead of socket.On

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

3 participants