question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clients don't receive messages

See original GitHub issue

I have server and clients in node.js.

Every time client connects to server:

var response = {};
if (currentPlayers < maxPlayers) {
    currentPlayers++;
    response.username = currentPlayers;

    players[currentPlayers] = {
        score: 0
    };

    socket.join('players');
} else {
    if (currentPlayers === maxPlayers) {
        //Set a little delay
        setTimeout(function () {
            //I also tried this:
            //players_sockets.forEach(function (s) {
            //    s.emit('start');
            //});


            io.to('players').emit('start');
        }, 1500);
    }
}

Server checks is there enough players for game, if it is, server emits start message. The problem is that some clients doesn’t receive this message(to be current: mobile devices(e.g. meizu mx5, iphone 5, iphone 5s and some others). I watched debug: they are using long-polling.

Desktop clients, which are connected with WebSocket are okay.

How i need to fix this? Or maybe I’m doing something wrong?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
baconbradcommented, Feb 23, 2021

I’m no expert here just learning but isn’t the point of websockets to replace long polling?

Socket.io doesn’t replace long polling. And by design it can fallback to XHR long polling if web sockets are unavailable or socket.io isn’t too warm and fuzzy about the web socket implementation. For whatever reason some browsers/clients make it switch to the fallback. I worked on an application where I only wanted web sockets. So I enforced it via the connection configuration using `“transports” : [“websocket”]`` and used Modenizr to ensure web sockets were available. This did the trick for me and the browsers quit performing a fallback to XHR long polling.

0reactions
darrachequesnecommented, Feb 18, 2021

Closed due to inactivity, please reopen if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clients aren't receiving email or SMS notifications
Problem. A client didn't receive an email or SMS message that should have been sent by an automated marketing campaign or as an...
Read more >
Why is my client not receiving SMS text messages?
If your clients are not receiving SMS notifications, there might be an issue with their contact information or subscription preferences.
Read more >
What Should You Do When a Client Ignores You?
Here's what to do if you can't get a hold of your client. Is your client dodging your emails and calls? It might...
Read more >
5 Reasons Your SMS Messages Don't Reach ...
Customer complaints lead to blocked numbers · Explicitly note how to opt out · Clearly identify the sender · Mention why customers are...
Read more >
10 Reasons Why Some Messages Don't Get Delivered
10 Reasons Why Some Messages Don't Get Delivered · 1) The recipient's phone is switched off · 2) False negative · 3) The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found