开发者

Easy to Program WebSocket Server

I'm starting to read about websockets, but I can't find a good WebSocket server and easy to program some examples...

I'm a complete beginner, and I don't need a server that supports a big concurrency, I just want something to try some examples...

Any Help??

T开发者_JS百科hanks!!


Keep in mind that websockets are new technology. The most recent draft protocol has just been submitted to become the actual standard. Opera doesn't even support the latest protocol yet and Microsoft is far behind (a partial implementation said to become available in version 10 MSIE). Chrome supports it in a development version. Firefox very recently released their version 7 that supports it. Don't be surprised if you need to become part of the "development community" as an early adopter: i.e. boot-strapping your way along as tools become mature and tutorials more plentiful.

You can follow my blog. I'm creating something that seems like it's just what you're looking for and it will be distributed free to developers. Timing might be good, even though it's not ready for distribution yet. It will be integrated with parts of what's called the HLL framework that will make applications easier to develop. I'd also like to make it possible to develop back-end application components using script, including JavaScript. I've already done some work on that in the HLL framework. There's a working demonstration and you can download the dhtml / javascript client and soon a non-browser client that you can also use to build application components. The server, built in pure Sun (Oracle) Java, runs equally well on both Linux and Windows. Since it would also provide the scripting engine, application components written in script would also be portable.

The websocket server supports the latest version of the proposed protocol, which has now been submitted to become the actual websocket standard. The demo will run on Chrome dev-channel (also known as Chromium) 14 or later. Also, Firefox 7 which has now been released (no longer in Beta).


The most popular server side JavaScript framework is NodeJS, it runs best on Linux currently with a windows version in development.

http://nodejs.org/

Follow the directions for installation here:

https://github.com/joyent/node/wiki/Installation

Once you've installed Node and NPM install the socket.io package:

npm install socket.io

Then visit http://socket.io/ for am introduction to the API where you can view the server side JavaScript and the client side JavaScript.


If you are wanting a WebSocket server written in JavaScript than I suggest you look at Socket.IO. It is very simple to use, and there is lots of documentation and examples that you can find online.

If you wanting to play with a low-level WebSocket server and JavaScript is not a requirement, you might check out my python based websockify project. The websocket.py module is a generic WebSocket server framework. There are some simple examples of using it in the tests directory. Websockify itself is built on websocket.py to create a fairly sophisticated websocket to raw socket bridge/proxy.


I've had good results with node.ws.js.

Do note though that it's (temporarily) incompatible with Chrome 14, because Chrome has now implemented the latest version of the IETF Hybi specification, and node.ws.js didn't catch up yet.

It works well with all version of Safari, though, including Mobile Safari.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜