setting up web sockets

When using web sockets all the tutorials I can find talk about the code for the client side. But the server side is just left out. What does the connection url here actually point too? Do I need to also be using PHP, Ruby, node.js or any server side language?

var connection = new WebSocket('ws://html5rocks.websocket.org/echo', ['soap', 'xmpp']);

Tutorial referenced:

http://www.html5rocks.com/en/tutorials/websockets/basics/


There are some server side languages that have Websockets support, I personally recommend using:

Socket.io

Who works over node.js, it's very easy to setup and a good starting point. Later you can have an Websockets endpoint in any language. Java and C# solutions are a bit complicated by the time.


Yes, you need a server that handles websockets. Many do including Apache HTTPD, Apache Tomcat, Play framework, and nodejs.

Here is an example: http://www.tomcatexpert.com/blog/2012/05/01/how-apache-tomcat-implemented-websocket


Have you seen the great (and simple) echo sample on websocket.org?

Also, Kaazing has a hosted WebSocket server, and a browser-based tutorial that walks you through a simple pub-sub example. Check out:

  • Tutorial Home Page with screencast of completed app
  • Seven-part blog post about with step-by-step instructions
  • Completed demo in JSFiddle (with HTML and JavaScript source code) Hint: Open this link in two browser windows an interact with the slider above the image
  • Hope this helps!

    链接地址: http://www.djcxy.com/p/44814.html

    上一篇: 具有负载平衡器可伸缩性的websockets

    下一篇: 设置网络套接字