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
Post a Comment