My app use Node.js and Socket.io. It works fine but when I disconnect from the internet, Socket.io falls back to xhr but just on Firefox, On chrome it works fine.
This my debug messages:
info - socket.io started
Express server listening on port 3000 development
GET /connexion 200 38ms - 882
POST /connexion 302 5ms - 64
GET /jeu 200 8ms - 583
debug - client authorized
info - handshake authorized UTHMxCJEKx-DC3sSf57M
debug - setting request GET /socket.io/1/xhr-polling/UTHMxCJEKx-DC3sSf57M?t=1365791206086
debug - setting poll timeout
debug - client authorized for
debug - clearing poll timeout
debug - xhr-polling writing 1::
debug - set close timeout for client UTHMxCJEKx-DC3sSf57M
debug - xhr-polling received data packet 1::/jeu/Jeu1
s:B2ZSTca4rYyle+ooJCY5/Z+d.xuW1XrVrU+IG0UpLvs5q88hm6Nr83SOwr7fpOjfPhbM
B2ZSTca4rYyle+ooJCY5/Z+d
debug - client authorized for /jeu/Jeu1
debug - setting request GET /socket.io/1/xhr-polling/UTHMxCJEKx-DC3sSf57M?t=1365791206116
debug - setting poll timeout
debug - clearing poll timeout
debug - xhr-polling writing 1::/jeu/Jeu1
debug - set close timeout for client UTHMxCJEKx-DC3sSf57M
debug - discarding transport
debug - cleared close timeout for client UTHMxCJEKx-DC3sSf57M
newPlayer: hamou92
debug - broadcasting packet
debug - setting request GET /socket.io/1/xhr-polling/UTHMxCJEKx-DC3sSf57M?t=1365791206203
debug - setting poll timeout
debug - discarding transport
debug - cleared close timeout for client UTHMxCJEKx-DC3sSf57M
This is what Firebug shows me:
Firefox ne peut établir de connexion avec le serveur à l'adresse ws://localhost:3000/socket.io/1/websocket/_uQklvPYeYn-_BNg-WDa.
this.websocket = new Socket(this.prepareUrl() + query); socket.io.js (ligne 2371)
Related
I have a Graphql server with subscriptions enabled, when accessed directly from my client it works great. Now what I need to do is reroute the connection through my backend (an express server).
I have the following configuration on my server:
app.use(
"/graphql",
createProxyMiddleware({
target: `http://${GQL_URL}`,
changeOrigin: true,
ws: true,
})
);
This eventually works, however, the first connection when the server starts-up, which I can see in my console the message [HPM] Upgrading to WebSocket takes over five minute to complete.
By the time it manages to upgrade the connection, the client has already disconnected and retried multiple times and I get "instantly" all the stacked pending retries:
[server] [HPM] Upgrading to WebSocket
[server] [HPM] Client disconnected
[server] [HPM] Upgrading to WebSocket
[server] [HPM] Client disconnected
[server] [HPM] Upgrading to WebSocket
[server] [HPM] Upgrading to WebSocket
[server] [HPM] Client disconnected
[server] [HPM] Client disconnected
[server] [HPM] Upgrading to WebSocket
[server] [HPM] Client disconnected
[server] [HPM] Upgrading to WebSocket
[server] [HPM] Client disconnected
[server] [HPM] Upgrading to WebSocket
After that, the connections to the server work properly.
In principle this is not a major problem, as when I deploy, the application will not work for a few minutes and then start working, is not ideal but not all bad.
However, the major problem is when I am developing. Whenever I make any change to the servers code and it reloads I have to wait those few minutes to properly checkout if my application is working.
How can I fix this issue? Am I missing something?
I'm using ngrok building a Secure tunnels to localhost server
On server side I run the command start ngrok
./bin/ngrokd -domain="tunnel.kmic168.com" -httpAddr=":8080"
Display
[07/12/17 17:37:16] [INFO] [registry] [tun] No affinity cache specified
[07/12/17 17:37:16] [INFO] [metrics] Reporting every 30 seconds
[07/12/17 17:37:16] [INFO] Listening for public http connections on [::]:8080
[07/12/17 17:37:16] [INFO] Listening for public https connections on [::]:443
[07/12/17 17:37:16] [INFO] Listening for control and proxy connections on [::]:4443
It seems fine. Then I run the command on client side
./ngrok -subdomain=rbp -config="ngrok.cfg" 80
and the
Tunnel Status: reconnecting .
Alway reconnecting. Then I checkd the server side display these error
[07/12/17 17:40:13] [INFO] [pub:7ac836d4] New connection from
119.130.171.143:25904 [07/12/17 17:40:13] [WARN] [pub:7ac836d4] Failed to read valid http request: malformed HTTP request
"\x16\x03\x01\x00\x9a\x01\x00\x00\x96\x03\x03;Qߓ\xccj\xb7nm\xa0\xe0\x86\x04\u007fH{W5\x10\xb1\xc4\xcc\xed\xe5\xbf\xc9\x00\xa1ĥbq\x00\x00\x1c\xc0/\xc0+\xc00\xc0,\xc0\x13\xc0\t\xc0\x14\xc0"
[07/12/17 17:40:13] [DEBG] [pub:7ac836d4] Closing [07/12/17 17:40:23]
[INFO] [metrics] Reporting:
{"bytesIn.count":0,"bytesOut.count":0,"connMeter.count":0,"connMeter.m1":0,"httpTunnelMeter.count":0,"linux":0,"osx":0,"other":0,"tcpTunnelMeter.count":0,"tunnelMeter.count":0,"tunnelMeter.m1":0,"windows":0}
Here is my cfg file content
server_addr: "tunnel.kmic168.com:8080"
trust_host_root_certs: false
Is there a solution to resolve this error? Thank you very much!
finally I found the solution
https://gist.github.com/lyoshenka/002b7fbd801d0fd21f2f
you have to use the port 4443
I'm having hard time trying to connect errbot to dev HipChat server because of invalid ssl cert.
log:
21:16:01 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: ssl_cert
21:16:01 ERROR sleekxmpp.xmlstream.xmlst Could not match certficate against hostname: chat.btf.hipchat.com
21:16:01 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: session_end
21:16:01 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: disconnected
21:16:01 INFO errbot.core Disconnect callback, deactivating all the plugins.
21:16:01 DEBUG sleekxmpp.thirdparty.stat ==== TRANSITION connected -> disconnected
21:16:01 DEBUG sleekxmpp.xmlstream.xmlst SEND (IMMED): <stream:stream to='chat.btf.hipchat.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
21:16:01 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: socket_error
21:16:01 WARNING sleekxmpp.xmlstream.xmlst Failed to send b"<stream:stream to='chat.btf.hipchat.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>"
21:16:01 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: session_end
21:16:01 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: socket_error
21:16:01 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: disconnected
21:16:01 INFO errbot.core Disconnect callback, deactivating all the plugins.
21:16:01 DEBUG sleekxmpp.thirdparty.stat ==== TRANSITION connected -> disconnected
21:16:01 DEBUG sleekxmpp.xmlstream.xmlst Event triggered: socket_error
21:16:01 ERROR sleekxmpp.xmlstream.xmlst Socket Error #9: Bad file descriptor
Errbot keeps verify cert even though I specified "'verify': False" in BOT_IDENTITY as well as XMPP_CA_CERT_FILE = None in config.
part of config:
BOT_IDENTITY = {
## HipChat mode (Comment the above if using this mode)
'username' : '1_2#chat.btf.hipchat.com',
'password' : '123qweASD',
## Group admins can create/view tokens on the settings page after logging
## in on HipChat's website
'token' : 'sometoken',
## If you're using HipChat server (self-hosted HipChat) then you should set
## the endpoint below. If you don't use HipChat server but use the hosted version
## of HipChat then you may leave this commented out.
'endpoint' : 'hipchat.test.intra',
'verify': False,
}
XMPP_CA_CERT_FILE = None
Any ideas how to make it work are really appreciated.
The source of this error happens in the verify function which verifies the certificate is valid in terms of hostname and validity date.
The value of XMPP_CA_CERT_FILE set in errbot's config is eventually passed to ca_certs in the XMLStream class where it's used to influence the cert_policy. That sets ssl.CERT_NONE but even so, it still calls verify.
That means currently you can have a (possible self-signed) certificate without a valid trust root, but you will still have to ensure the hostname you're connecting to matches the hostname (CN) of the certificate. (This is something which SleekXMPP, the underlying XMPP library used by errbot imposes on us and not directly something from errbot itself).
I am having a problem with socket.io (websocket) when running in EC2. I don't have any http proxy or loadbalancer installed infront of the node instance. Same code works fine when running in local environment but keep reconnecting in EC2. Also even in the EC2 instance xhr-polling works fine.
Following is socket.io debug log output when transport is set to websocket and xhr-polling.
debug - discarding transport
debug - authorized
info - handshake authorized aoiP_6qFnqiqEC3r2-0N
debug - setting request GET /socket.io/1/websocket/aoiP_6qFnqiqEC3r2-0N
debug - set heartbeat interval for client aoiP_6qFnqiqEC3r2-0N
debug - client authorized for
debug - websocket writing 1::
warn - websocket parser error: reserved fields must be empty
info - transport end (undefined)
debug - set close timeout for client NxkBCtJqwOscfHzE0xba
debug - cleared close timeout for client NxkBCtJqwOscfHzE0xba
debug - cleared heartbeat interval for client NxkBCtJqwOscfHzE0xba
For some reason unknown my server is shutting down and I have login on server and run my app again. Someone had that problem?
Here is my log.
info: socket.io started
debug: client authorized
info: handshake authorized m2-7nzTeYuhWz7aT9-AQ
debug: setting request GET /socket.io/1/websocket/m2-7nzTeYuhWz7aT9-AQ
debug: set heartbeat interval for client m2-7nzTeYuhWz7aT9-AQ
debug: client authorized for
debug: websocket writing 1::
debug: websocket writing 5:::{"name":"connect","args":[{"objSeats":{"4536":{"5851":{"6":[]}}}}]}
debug: websocket writing 5:::{"name":"connect","args":[{"objSeats":{"4536":{"5851":{"6":[]}}}}]}
debug: websocket writing 5:::{"name":"connect","args":[{"objSeats":{"4536":{"5851":{"6":[]}}}}]}
info: transport end (socket end)
debug: set close timeout for client fgFEi9a8ZCJ4vGe49-AO
debug: cleared close timeout for client fgFEi9a8ZCJ4vGe49-AO
debug: cleared heartbeat interval for client fgFEi9a8ZCJ4vGe49-AO
debug: discarding transport
info: transport end (socket end)
debug: set close timeout for client vbWkAQBC6rMIiOl99-AP
debug: cleared close timeout for client vbWkAQBC6rMIiOl99-AP
debug: cleared heartbeat interval for client vbWkAQBC6rMIiOl99-AP
debug: discarding transport
info: transport end (socket end)
debug: set close timeout for client m2-7nzTeYuhWz7aT9-AQ
debug: cleared close timeout for client m2-7nzTeYuhWz7aT9-AQ
debug: cleared heartbeat interval for client m2-7nzTeYuhWz7aT9-AQ
debug: discarding transport
debug: client authorized
info: handshake authorized i5J-qT9e34ta2l3J9-AR
debug: setting request GET /socket.io/1/websocket/i5J-qT9e34ta2l3J9-AR
debug: set heartbeat interval for client i5J-qT9e34ta2l3J9-AR
debug: client authorized for
debug: websocket writing 1::
debug: websocket writing 5:::{"name":"connect","args":[{"objSeats":{"4536":{"5851":{"6":[]}}}}]}
info: transport end (socket end)
debug: set close timeout for client i5J-qT9e34ta2l3J9-AR
debug: cleared close timeout for client i5J-qT9e34ta2l3J9-AR
debug: cleared heartbeat interval for client i5J-qT9e34ta2l3J9-AR
debug: discarding transport
debug: client authorized
info: handshake authorized RJTRf_Jy2WX-uUej9-AS
debug: setting request GET /socket.io/1/websocket/RJTRf_Jy2WX-uUej9-AS
debug: set heartbeat interval for client RJTRf_Jy2WX-uUej9-AS
debug: client authorized for
debug: websocket writing 1::
debug: websocket writing 5:::{"name":"connect","args":[{"objSeats":{"4536":{"5851":{"6":[]}}}}]}
debug: emitting heartbeat for client RJTRf_Jy2WX-uUej9-AS
debug: websocket writing 2::
debug: set heartbeat timeout for client RJTRf_Jy2WX-uUej9-AS
debug: got heartbeat packet
debug: cleared heartbeat timeout for client RJTRf_Jy2WX-uUej9-AS
debug: set heartbeat interval for client RJTRf_Jy2WX-uUej9-AS
info: transport end (undefined)
debug: set close timeout for client RJTRf_Jy2WX-uUej9-AS
debug: cleared close timeout for client RJTRf_Jy2WX-uUej9-AS
debug: cleared heartbeat interval for client RJTRf_Jy2WX-uUej9-AS
debug: discarding transport