Olivine-Labs / Alchemy-Websockets

An extremely efficient C# WebSocket server.
http://AlchemyWebsockets.net
Other
309 stars 105 forks source link

WebSocketHandler still doesn't send CloseFrame correctly #89

Open Mizutama opened 10 years ago

Mizutama commented 10 years ago

You changed WebSocketHandler.HandleRequest() to send close frame as; case DataFrame.DataState.Closed: DataFrame closeFrame = context.UserContext.DataFrame.CreateInstance(); closeFrame.State = DataFrame.DataState.Closed; closeFrame.Append( new byte[] { 0x8 } , true ); context.UserContext.Send( closeFrame , false , true ); break; but it makes incorrect frame. This could be (I've tested) case DataFrame.DataState.Closed: DataFrame closeFrame = context.UserContext.DataFrame.CreateInstance(); closeFrame.State = DataFrame.DataState.Closed; closeFrame.Append( new byte[] { 0x88 , 0 } , false ); closeFrame.Format = DataFrame.DataFormat.Frame; context.UserContext.Send( closeFrame , false , true ); break;