Connection Failed: Invalid Frame Header in Chrome.
The first message works. (Send or Broadcast) but the second message always closes the connection in chrome with
"WebSocket connection to 'ws://localhost/' failed: Invalid frame header"
Oddly enough, Internet Explorer doesn't do this. (IE works fine)
I switched from C# Fleck to this and wasn't having any issues before. I really liked how this library could handle HTTP and Websockets. Thanks.
EDIT: Thought I should mention I'm using HttpServer and AddWebSocketService
WebSocket connection to 'ws://localhost/' failed: Invalid frame header in Chrome and opera IE and Firefox works fine
Same problem here, first works, but the second message always closes the connection in chrome with "WebSocket connection to 'ws://localhost/' failed: Invalid frame header"
Disabling compression seems to fix this.
Same problem here, but it only occurs in Firefox and Firefox Developer Edtion. Always the second message throws this error and close the connection.
14/04/2015 09:32:09|Fatal|WebSocket.processException|WebSocketSharp.WebSocketExc
eption: The header part of a frame cannot be read from the data source.
em WebSocketSharp.WebSocketFrame.<>c__DisplayClass7
.
code:
class Program
{
static void Main(string[] args)
{
var server = new WebSocketServer(8081);
server.AddWebSocketService<Atualizador>("/");
server.KeepClean = true;
server.Start();
Console.WriteLine("Servidor iniciado");
string teste = string.Empty;
while (!teste.Equals("sair"))
{
teste = Console.ReadLine();
server.WebSocketServices.Broadcast(teste);
}
server.Stop();
}
}
class Atualizador: WebSocketBehavior { }
In Firefox console I just do:
var ws = new WebSocket("ws://localhost:8081");
ws.onmessage = function(data){alert(data.data);};
Any news about this? or how to disable compression?
@Slyb00ts you can disable compression by commenting out / putting something like #if EXT_COMPRESSION around this if statement:
https://github.com/sta/websocket-sharp/blob/master/websocket-sharp/WebSocket.cs#L1074
@Metapyziks works for me very well! Thanks very much :smiley:
I have the same problem trying to connect to websocket from new firefox 37.0.1, but in older firefox it worked. In chrome it works so far. That means something changed in the protocol in firefox
I am having the same issue as BBGONE. ~~WebSockets work in Chrome~~ Tested latest from master and gets Invalid frame header in Chrome.
Possibly related: the connection dies after the first message in Firefox 37. Firefox implemented permessage-delate in 37. This is probably related: https://bugzilla.mozilla.org/show_bug.cgi?id=792831
This is probably a similar problem (wrong BFINAL): http://stackoverflow.com/questions/22169036/websocket-permessage-deflate-in-chrome-with-no-context-takeover
Hello there,
Could you try the latest code? Thx!
@sta thanks! Now it works fine in Chrome 42, but was indeed failing after sending a second request
Second confirm? I don't have the environment nor the time to test myself, thanks
Unfortunately in FF 37.0.2 it fails completely at the moment. I'm testing it from websocket.org/echo.html - a connection is established to WebSocketServer, but after a couple of seconds it throws:
2015-05-08 09:11:40|Fatal|WebSocket.processException:1005|WebSocketSharp.WebSocketException: The header part of a frame cannot be read from the data source.
in WebSocketSharp.WebSocketFrame.<>c__DisplayClass7.<ReadAsync>b__6(Byte[] header) w e:\dev\GitHub\websocket-sharp\websocket-sharp\WebSocketFrame.cs:line 566
in WebSocketSharp.Ext.<>c__DisplayClass6.<ReadBytesAsync>b__5(IAsyncResult ar) w e:\dev\GitHub\websocket-sharp\websocket-sharp\Ext.cs:line 683
2015-05-08 09:11:40|Trace|WebSocket.close:680|Begin closing the connection.
2015-05-08 09:11:40|Debug|WebSocket.closeHandshake:723|Was clean?: False
sent: False
received: True
2015-05-08 09:11:40|Trace|WebSocket.close:687|End closing the connection.
IE 11 works fine
@sta it works fine for me too with chrome 42, thanks
With Firefox 38.0 (as tested on Win7 x64) disabling the option about config for websocket deflate extensions allows the connection to be established. Set "network.websocket.extensions.permessage-deflate" to false and the connection works.
Didn't work out why fully but it might be the disclaimer the author offered w/respect to "Per-message Compression" on https://github.com/sta/websocket-sharp. The status returned by the server clearly indicates this as well by returning the following "Sec-WebSocket-Extensions: permessage-deflate; client_no_context_takeover; server_no_context_takeover"
Perhaps the mozilla authors are assuming something different even though his code or there is a deeper issue. Hopefully this observation will allow the author to look deeper.
One further note; there is a thread on Stack Overflow regarding a similar issue that may be helpful. See: http://stackoverflow.com/questions/22169036/websocket-permessage-deflate-in-chrome-with-no-context-takeover
@sta @dmeade4303 when I set WebSocketBehavior.IgnoreExtensions to true when my service is created, so that extensions like compression are disrespected - everything works fine with FF 37
@sta @tporadowski this makes sense given what I saw. Appears to be the same mechanism underlying it all; something with the server's responses and handling of the "context takeover" if the thread I provided a link to is correct.