I'm connecting to a .net core signalR hub from an Angular client (#microsoft/signalR).
The connection seems to be successful but every once in a while i get 404 when trying to connect. (http://myserver:myport/myHub?id=____)
this is how i build my connection:
new signalRBuilder.HubConnectionBuilder()
.withUrl(myUrl)
.**withAutomaticreconnect**([100,5000,10000,15000])
.build.start()
I cant figure out why the connection is dropping.
Related
when I wrote server for game I got problem:
SignalR hub (with MessagePack) removes connection ID and then disconnects client.
Any Timeout options (in .AddSignalR) & Nginx headers doesn't help.
I am trying to use the same port on the same host.
Websocket URL
ws://aaa.bbb.cc.ddd:eeee/ws
HTTP URL
http://aaa.bbb.cc.ddd:eeee/docs
But when I open the "http://aaa.bbb.cc.ddd:eeee/docs" page, I get this error message.
Failed to open a WebSocket connection: invalid Connection header: keep-alive.
You cannot access a WebSocket server directly with a browser. You need a WebSocket client.
Http does not work. But, websocket is connected normally.
How can I solve this problem?
The WebSocket protocol is not the HTTP protocol.
Although the WebSocket protocol does initiate a new connection using an HTTP request, it quickly upgrades the connection to full WebSocket (which requires a Connection: upgrade header in the initial request, not Connection: keep-alive).
You can't use a vanilla web browser to directly communicate with a WebSocket URL, as such a browser doesn't know how to finish the upgrade, let alone process any WebSocket packets. So, you must use a valid WebSocket client (such as the WebSocket API that modern browsers expose to client-side scripting).
I have a question about websocket and asp.net core.
I build my application with this tutorial ( Link ) , it works on my local host : 'ws://localhost:1602/ws' and on server when I open webpage from remote desktop on server.
but when I open webpage with Url from my computer it show me this error :
WebSocket connection to 'ws://subdomain.domain.com/ws' failed: Error during WebSocket handshake: Incorrect 'Sec-WebSocket-Accept' header value.
I mean when i open webpage on domainit fails.
I added WebSocket on server but error still remains.
thank you for your help.
It could be due a proxy issue. That is exactly the mission of Sec-WebSocket-Accept header, to prevent giving the connection as opened when the response is a cached one from a proxy, since only the real WebSocket server will know how to create that header right.
Switch to HTTPS and WSS and the problem will probably go away, since proxies cannot cache secure connections.
How HTML5 Web Sockets Interact With Proxy Servers
The problem is this:
I decided to make a messenger/chat (VCL application) with callback on DataSnap technology (IDE Delphi XE6), has created a simple DataSnap server (tcp / ip + http) without the database, and thick client.
All works fine if the whole thing run on a local network (tcp / ip) or via the Internet (http).Problems arise when run over HTTP and the client machine has a HTTP proxy server, the client application can not connect to my DataSnap server application. Client application gets error "10061 connection refused"
or "Expected datasnap context in request http://[YourServerIP]:[YourPort]/datasnap/tunnel".
I tried to enter IP and port of the proxy server to params of component TSQLConnection.Driver params DSProxyHost and DSProxyPort, turned off my firewall and antivirus software, checked allows traffic to the proxy ip + port, but the problem has not disappeared.
After few days searches, without results, i decided listening requests from client application and response of my DataSnap Server application in HTTPTrace procedure of DSHTTPService1 component, also with software HTTPDebugerPro, and i noticed interesting thing:
when client app connecting to ds server app without proxy server, in request ds server app receive URI with this text "/datasnap/tunnel" and all works fine ds server response "200, OK".
when client app connecting to ds server app with proxy, in request ds server app receive URI with text "http://[YourServerIP]:[YourPort]/datasnap/tunnel" and raised exception with response error "404, Expected datasnap context in request http://YourServerIP:YourPort/datasnap/tunnel".
Has anyone knows solution about this problem? How to connect DataSnap client to DataSnap server via proxy server? I searched solution for this problem several days, I shoveled the Internet but have not yet found a solution.
Is there a way that can verify my app client in mobile has established a keep-alive https connection with my Azure web service? That during a period, requests from the same client will not do TCP/IC connect and HTTPS handshake.
I tried to use fiddler to capture packages between app client and azure service but seems useless because fiddler itself makes a keep-alive connection with server side.
And I know that http 1.1 has set keep-alive as default. However I just curious is there are any method can verify that. Thanks.