0

I need to connect and send data packets to a UDP server (connection less/datagram socket) from within a browser.

  1. What are my options?

  2. Does HTML5 allow connection-less sockets?

  3. Would I be able to connect to a UDP server (connection-less socket) using a WebSocket?

Matt
  • 74,352
  • 26
  • 153
  • 180
zabumba
  • 12,172
  • 16
  • 72
  • 129
  • HTML 5 does not allow that. You could use some flash based object to overcome the limitations of javascript - see http://stackoverflow.com/questions/907041/is-it-possible-to-use-udp-in-flash-actionscript – Pavel Bucek Jun 17 '14 at 15:39

1 Answers1

2

Your options are very limited. Browsers which support WebSockets expect the server to speak WebSocket to them (which involves participating in a 2-way handshake). Communicating in raw UDP is an entirely different kettle of fish.

Chrome has experimental support for raw UDP, but only for Chrome extensions.

I don't know of any other browser with this in the works, or for Chrome to make it available for websites.

Your best best would be to change your endpoint to talk WebSocket, or to use a middleman server (NodeJS would be great for this) to handle the Websocket <-> raw UDP conversion.

Matt
  • 74,352
  • 26
  • 153
  • 180