2006-05-26
“Real” Javascript Sockets!
I could not find a single way to have real sockets in Javascript. Google told me that there probably is no solution except embeding a java applet or an active-x component! So I thought why not using a little .swf file as a bridge from javascript to the socket functions of flash!
You can see the result here:
http://dev.dschini.org/socketjs/
This works pretty neat, fast and stable! The client connects to a patched ("\0\n") Unreal IRCD. Except connecting and joining a channel there is no much functionality, but it works pretty good! If you are interested please give me some feedback!
37 Comments
-
This works great when connecting to a server on localhost, but when connecting to a server over the internet or even over LAN, I simply can’t get it to work.
If anybody knows how to fix my problem, PLEASE help me. I’ve made an awesome online game with this but no players can connect! E-mail me: kaoskorruption at gmail.com. Thanks.
-
hey sly,
this is funny :) -
Hi,
This is a great idea. After some rough start I’ve finaly putted it to work with the server (only sending, not receiving yet).
The problem seems to be that “socketjs” send’s a “” character after each send. The server software doesn’t like that…
The server isn’t sending the “” character back and the “socketjs” doesn’t like that either..
Does any one know if this “real sockets” have to send these annoying “” characters on both ways each send?
I don’t have the “flash” editing software so I can’t really tweak anything… :-(
Thanks to all, nice work.
-
Hi AkonD,
you can download the patched server here:
http://dev.dschini.org/Unreal3.2.zip
After unziping you have to set chmod to some important files.
– Manfred -
Outta curiosity, how does your library compare to Aflax?
(I used that library to build my first javascript socket project, but I’m not sure how it compares. The approach is similar…
… but presumably, yours would be a little better, if a person only wanted socket connections and nothing else.
Thanks a lot for figuring this stuff out — it’s a clever solution which really makes a lot of things possible.
-
Hi,
I just started using javascript for client-server programming and found socketJS is very convenient and powerful.Everything works for me if I put it on the local disk of the browser, like file:///C:/test/index.html. It can send and receive data from a remote server.
But it fails when I have it (html, swf) on a web server, like http://192.168.1.203/test/. In this case, I can get the page right and swf is downloaded to the browser. I have “SocketConnect(’192.168.1.201′,6688)” in the html. But when I click on the “Connect”, it tries to connect to 192.168.1.201:80 instead. The destination port is changed to 80.
Any idea?
Thanks for sharing.
-
Hi Pascal,
That does not work because the socket of the flash-movie within the html page needs to be in the same network domain like the sockets is.
Best Regards
Manfred -
Hi,
looks interesting. I will have a deeper look at it.
cheers
Manfred -
hey Ken. I had a look at your website an especially the chat system. looks very impressive! wow!
