socket.io and .Net socket server - comet

Excuse me if the question sounds silly but I have to ask. Is there a server side alternative to Node.js written in C#? I need a client framework to fully utilize Web Sockets but AFAIK IE doesn't support Web Sockets and nor will it support in it's next version. socket.io uses Web Sockets if available and falls back to BOSH if not. So I will try to connect to a socket server that is running on .Net Framework.
What are my alternatives?

Excuse me for raising this thread from the dead - my friend and I just posted a server-side websocket server for C#: https://github.com/Olivine-Labs/Alchemy-Websockets
It's fast, it's scalable, and doesn't do everything socket.io does, on purpose: it provides websockets and a flash fallback, which keeps it very lean and efficient. I see you've already done your own stuff, but check it out; and hopefully it'll help others on SO.

Might be an answer to an old question, but I'll write here in case other finds this question using a search engine. Have a look at SignalR (http://signalr.net/) for that abstraction. For a nice post on what SignalR is please read Scott Hanselman's post http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx.

Related

Delphi - Websockets and uniGUI

I am really a beginner in delphi, as the client request the project to be done in delphi, so I have to ask to get some help as possible as I can. This project will be involved in HTML5 and websockets as well, so there are some questions I need your advices.
Sorry let me explain more, this application have two parts mainly, one is HTML5 client web app (this app will be loaded from web server, and run locally in browser), and the other is its service located in server. The HTML5 web app is doing some product editing job, as well send its final output to server, during this process, there will be many communications between client app and service, and I planed to use Websockets.
I did plan this application in HTML5 and Node.js before, but as client send request to ask for the Delphi XE as primary development tool also it will be compiled to DLL (ISAPI, have to be) at last. For consistency of UI, I also was required to use uniGUI (http://www.unigui.com/demo)for Delphi. Now I have these questions:
Is there any other way to do this application with HTML5 as web front exclude uniGUI in Delphi?
What good libraries support Websockets in Delphi?
What book you can recommend me to read, as I don't know Delphi at all.
Thanks.
1: yes, make a "single page app" (static html + js) and communicate with server using xml or json.
At least with indy 10 it is quite straight forward to implement static file serving (response.contentstream := tfilestream.create(sfilename) or something like that)
2: yes, if you search for it on google you will find some :)
WebSocket server implementations for Delphi
btw, I'm busy with delphi socket.io implementation, which makes it easier to use websockets instead of plain low level tcp-like websockets itself
Is there any other way to do this application with HTML5 as web front exclude uniGUI in Delphi?
First concept : HTML5 applications are a bunch of HTML files and JS's wich can be processed by browsers.
Second concept : You need an application that can bind HTTP queries and return files from the first concept.
Third concept (paradigm) : With first two concepts, a third concept arises. Dynamic HTML. What is dynamic HTML? HTML that generates at runtime at the backend server and/or at frontend with JS.
Solution :
Yes, with Delphi as a backend server you can manipulate and return HTML5 views, if you know (MVC paradigmn for example) you can program an HTTPServer application that binds HTTP request from network and responses your HTMLs and JS.
What good libraries support Websockets in Delphi?
You need a multilayer library. The best library I know is mORMot. mORMot is like a swiss razor for Object Pascal.
You can create an HTTP server with websocket published interfaces. mORMot's Site
What book you can recommend me to read, as I don't know Delphi at all.
I have more than 10 years with Delphi and Free Pascal and I didn't read a book at all. But I read a lot from internet and a lot of computer architecture and another languages like C and C++.
If you like Delphi there are tons of documentation via Internet. I cannot recomend you a book because I will lie you.

Converting an application from Unity3d to Flash

I am attempting to convert my Unity3d game to flash but am experiencing trouble with comments. Because of the socket trouble, I am trying to use Json and Post, but I don't know where to start. I saw this
Java server- client socket communication
but it incorporates sockets.
This is for the user client, but I also need to redo the server side. I believe I need a web server to get the Json strings and return the appropriate response.
Am I doing this right, or is there something I am overlooking?
This may lessen the amount of work quite a bit if you are interested in using an API. Smartfox is an awesome Client API / Multiplayer server tool that can increase output time as well as allow you to implement efficiency code to improve server stability.
It works for both Unity3D and flash.
http://www.smartfoxserver.com/
Addressing your main question I believe you would need a server to effectively use Json and be able to communicate to the clients however this is where smartfoxserver can come in handy. I have not had much experience in the flash multiplayer programming however smartfox is a great tool and I used it to make multiplayer programs in unity3d.
Hope this helps!
Mitch

application design: Scala + HTML5

I'd like to implement an application with Scala and HTML5. My idea was to create a "local" client-server architecture: Scala handles the calculations and generates HTML5 as a GUI.
To my mind there are two possibilities
Use a Java/Scala framework that allows embedded HTML5. SWT for example has a browser widget. JavaFX seems good, too.
Distribute the program with a server and run it in a browser on localhost.
It would probably be most convenient to require an internet connection and forget about the localhost. Unfortunately an offline mode is necessary.
Now I would like to know how to get this right:
The first option seems easier to implement but I wonder: How can I communicate with Javascript without the HTTP protocol ?
The second approach was just an idea. Have you ever done something like this ?
If you've got advice or know a good framework please go ahead.
UPDATE :
I've just had an interesting idea: Could I use nodejs to create something like a server-server architecture ?
Right now the communication between Scala and Coffescript seems like the most problematic part. I still wonder how I could initiate an update from the Scala side of the application. A HTTP Request is a nice way to exchange data. Sadly to my knowledge in "standard" Coffeescript there would be no event hook to listen to server-side HTTP messages.
I've thought about using nodejs to listen to the server-sent data. Is this a good idea ?
With regards to the second option, you may wish to investigate the Play! Framework or Lift. They automate a lot of the work required to make a web application in Scala, including handling AJAX requests.
Although I haven't tried packaging either for local use, there was an earlier Stack Exchange question about packaging Lift which might be relevant. It should be possible with Play! as well.

WebSocket server list

I am looking to start a HTML5 WebSockets project and I was just wondering what you think the best back-end would be for that sort of thing? So far in my research I've stumbled across the following:
PHP Back-end (apparently a "Hack" and only compatible with Chrome and webkit nightlies)
Java Back-end (Seems well documented and cross-browser compatible)
Ruby Back-end (Don't know much about ruby, any opinions?)
JavaScript Library (Seems like it would be a nightmare, any opinions?)
Does anyone know of any other options or have an opinion on the above? My only requirements are ease of set-up and easy back end programmibility for bidirectional communication. I would essentially like to access a database through WebSockets and am looking for the easiest way to do this. Any feedback would be appreciated.
Ease of setup would have to be a hosted solution which uses WebSockets, HTTP Streaming or HTTP Long-Polling (one of which I work for). They're the easiest option because you don't need to spend time installing your solution, configuring it and working out how to use in when developing and in production.
If you are looking for a self hosted solution then it really depends on what technology you'd prefer to use and what the community for that technology is like.
Node.js and socket.io has a big community following at the moment so it wouldn't be a bad choice.
PHP - I'm afraid that PHP isn't really build with long-held persistent connections in mind. So, although there are options it's probably best to either use a hosted service or steer clear.
Ruby - check out Faye (also has node.js option), Juggernaut or Cramp
Java: As you say, jwebsocket or WaterSpout Server
Hope this helps.
I 'd recommend websocketd
http://websocketd.com/
It 's a thin layer you can wrap around any program that reads from stdin and writes to stdout and transform it to a websocket server.
So you can write in any language you like. Afterwards just
$ websocketd --port=8080 my-program
and you have your server.

Comet Chat in GoDaddy Linux Dedicated Server?

I want to know if it's possible to make my own chat application with ajax push.
And if it's, what is the easiest way to do it?
I know how to use javascript and make ajax calls but that's as far as I go. I can find tutorials myself but I can't tell whether the method is good or not so any links will be appreciated.
Thanks
to use ajax push (comet), you must make a server that will keep concurrent connections.
You can really do anything look for echo servers in your favorite language. Java/C/C++.. I'd do this in Java since it can run on Linux as well.
You can use http://www.ape-project.org/ which seems to be done already all for you.. but seems complex.. I'd recommend starting from scratch with a echo server.
I would recommend using Node.js as it is great at Comet/Ajax-push. Why is it great? Comet applications tend to be event driven and Node.js/javascript excels at these kinds of things.
However, if you prefer to do it in Java, Tomcat actually supports Comet as long as your servlet implements CometProcessor and you use NIO as your http connector. See http://tomcat.apache.org/tomcat-6.0-doc/aio.html