c++ - Websocket messages after handshake -


i made websocket communication on server, in c++. have problem websocket protocol. when handshake message in text format, make handshake response , send in text format , connection opened, when sending second message browser connection fails. if put handshake answer in frame on first message, works fine later, don't have problem other messages.

mozzila firefox: connection ws://localhost/ interrupted while page loading. google chrome: websocket connection 'ws://localhost/' failed: server must not mask frames sends client.

i don't mask frames.

this works on mozzila firefox , google chrome, doesn't work on safari. so, know problem is? did have problem?

thanks

you not masking frames (from server client), in data sending back, please check first bit of second byte.

according rfc6445 first bit of second byte (the mask flag) must set 0 when sending data client. if frame isn't set correctly , bit set 1, browser going complain "a server must not mask frames sends client"

also may irrelevant you, check don't have trailing data in upgrade/handshake part of code, when working on web sockets, having trailing chr(0) (null character) caused issues me later on when trying send client data.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -