Jump to content

Websockets chat - long connecting to chat server


w01
 Share

Recommended Posts

It is entirely dependent on the library you are using. Given that you've gone native on the clientside have you tried using a separate php module that wraps websocket functionality?

 

Sounds like it is maybe having some delays in disconnecting and reconnecting. What happens when you connect in one tab and then open a few others and connect there? Any delay? Have you tried different browsers connection speeds?

 

I've just finished updating a websocket library built on top of socket.io (node) and never experienced delays connecting, and never has any reported but socket.io does the heavy lifting in any case and their userbase is large so would have caught things like this. There looks like a port to PHP, called elephant.io, I think it just routes through to a small node server for the websocket stuff, maybe try that implementation (there are many other PHP only libs too) and see if you still have problems.

Link to comment
Share on other sites

Hello @mattstyles

 

I performed few checks and:  there is no problem with connecting on multiple tabs (I'm connected just after page is loaded). Problem exist only when I'm refreshing site (by F5 or just by open this same page in this same tab) 

Link to comment
Share on other sites

This happens under nginx if you're passing the websocket port through nginx as a reverse proxy. Are you doing that by chance? I know sometimes nginx has a small delay on refresh when connecting to websocket ports.  I found that using  proxy_connect_timeout 1s;  inside your websocket server block fixed that..  

 

But if not under a reverse proxy, not sure man, I'm sorry..

 

Might have something to do with nginx timeout settings though.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...