2

I'm trying to mask a message ("hello") to send through WebSocket to a server.

I know that this should be masked. I want to know how to mask and how to send it when masked? Is it simply just socket.send(masked array)?

pimvdb
  • 151,816
  • 78
  • 307
  • 352
Tos
  • 21
  • 1

1 Answers1

1

Are you worried about the masking described in the data framing section of the protocol spec? If so, you shouldn't have to worry about this when using JavaScript. You can just call socket.send("hello") and rely on the browser masking the data appropriately for you.

simonc
  • 41,632
  • 12
  • 85
  • 103
  • Hm thats starnge if you have experinse in webSocke serve node.js mayby you can take a look at my code and see if im missing something im using chrome 17 – Tos Dec 20 '11 at 13:52
  • Happy to take a look at your code. Can you also confirm whether you are writing client or server code please? (Your comment about node.js server has confused me) – simonc Dec 20 '11 at 14:07
  • im doing both thank you for clearing up earlier i actually manage to send from client to server now and unmask. I have another problem now i have problem sending from server to client the on message never fires. im using the Node.js server but i want to do the handshake my self so im not using socket-server or other libarys. – Tos Dec 20 '11 at 14:37
  • Glad to hear you're making progress. It might be easiest to post your new problem as a new question. Code (either real or psuedo) will be real help too! – simonc Dec 20 '11 at 14:58