[Libwebsockets] Sett a Mask

Chropin Hu chropinhu at gmail.com
Wed Jul 25 10:16:13 CEST 2018

A client MUST mask all frames that it sends to the server (see Section
5.3 <https://tools.ietf.org/html/rfc6455#section-5.3> for further

(Note that masking is done whether or not the WebSocket Protocol is
runningover TLS.)

The server MUST close the connection upon receiving a frame that is
not masked.

In this case, a server MAY send a Close frame with a status code of
1002 (protocol error) as defined in Section 7.4.1

A server MUST NOT mask any frames that it sends to the client.  A
client MUST close a connection if it detects a masked frame.

In this case, it MAY use the status code 1002 (protocol error) as
defined in Section 7.4.1
<https://tools.ietf.org/html/rfc6455#section-7.4.1>.  (These rules
might be relaxed in a future specification.)

You can check the spec for more info.


On Mon, Jul 16, 2018 at 10:01 PM, Justin Osterholt <shroder at gmail.com>

> Hello,
> Is possible to set the mask headers for websocket data transferred over a
> non-ssl connection?
> Looking at the documentation I see lws_write_protocol has
> <https://libwebsockets.org/lws-api-doc-master/html/group__sending-data.html#gga98b099cf8c1c7e38ad78501f270e193da220d8e8652d9b97fb66e476e2a60ffce>,
> but from the description, this doesn't sound right.
> I believe once I switch over to using a secure connection I won't need to
> worry about this. If I can get confirmation on that it would be helpful.
> Best Wishes,
> Justin
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20180725/403c7b47/attachment-0002.html>

More information about the Libwebsockets mailing list