chat client using Openfire, Javascript (strophe.js), and html5 websockets? - javascript

I want to build a XMPP web-based chat client to add on to outlook web access. I've read that Javascript is problematic.
Could I use html5 websockets using the openfire server and the Javascript(strophe)?
I've read on other solutions that include using flxHR, a flash library.
Which would be better?

Just use an existing XMPP/BOSH library for JavaScript, such as Strophe.js. You don't need to wait for WebSockets.

A lot of the WebSocket libraries, technologies and services provide fallback for browsers that don't support WebSockets. This is generally done via Flash but some libraries also fallback to HTTP streaming or polling.
Have a search for WebSockets on the following page for available technologies:
http://www.leggetter.co.uk/real-time-technologies-guide

Related

SignalR peer to peer (js to js) communcation

I'd like to support a LANClient to LANClient connection between two or more JS clients. I plan to use a permanent external C# server to establish the local connection (identify if two clients are on the same LAN and exchange their local net addresses).
Is there any support for this in SignalR? Is it possible to host a hub server on JS? Is there any support for direct client to client communication?
Thanks!
No, taken from http://signalr.net/
What is ASP.NET SignalR
ASP.NET SignalR is a new library for ASP.NET developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.
You may have heard of WebSockets, a new HTML5 API that enables bi-directional communication between the browser and server. SignalR will use WebSockets under the covers when it's available, and gracefully fallback to other techniques and technologies when it isn't, while your application code stays the same.
SignalR also provides a very simple, high-level API for doing server to client RPC (call JavaScript functions in your clients' browsers from server-side .NET code) in your ASP.NET application, as well as adding useful hooks for connection management, e.g. connect/disconnect events, grouping connections, authorization.
So, to communicate the clients using SignalR, you should use a SignalR HUB.

Node.js web application browser compatibility

I heard node.js is an ideal framework for building real time web application (chatting, live feeds etc...), then i guess it involve lot of socket io connection between nodejs and client browser.
in client side do i have to use websocket(html5) in order to communicate with node.js, if that is the case, then most of the older browser won't support HTML5-Websocket.
Question :
are real time web applications built using node.js will work only with HTML5 compatible browsers.?
Many nodejs chat applications use socket.io.
socket.io has a fallback (involving pulling or Flash) for browsers not having websockets :
Socket.IO aims to make realtime apps possible in every browser and
mobile device, blurring the differences between the different
transport mechanisms. It's care-free realtime 100% in JavaScript.
The point of using socket.io is that you don't really care, you just use it and most browsers will use websockets while some won't (but they still will work as well as possible).
I heard node.js is an ideal framework for building real time web application (chatting, live >feeds etc...), then i guess it involve lot of socket io connection between nodejs and client >browser.
Yes, what you have heard is correct. It does involve a socket.io connection between client browser and the server
Read more about socket.io here
in client side do i have to use websocket(html5) in order to communicate with node.js, if >that is the case, then most of the older browser won't support HTML5-Websocket.
socket.io package of Node JS creates a WebSocket connection internally, if the client is using HTML5 enabled browser. In other browsers, it will fall back gracefully to different transport mechanisms.
Question : are real time web applications built using node.js will work only with HTML5 >compatible browsers.?
Above comments must have made clear, it will work in all supported browsers, if you use socket.io :)
See Browser support for socket.io

Socket reading and writing from a web browser app

There is a server I need to talk to that publishes a protocol over TCP/IP for querying data from a database and listening on a socket to receive notifications when data is updated. The sever guys provide a Java API which uses this TCP protocol. This means I could easily write a Swing App to talk to this server.
I would like a browser based solution. As the protocol is known to me, could I do this in JavaScript? My app will have to display the data in a table. I have heard of Web Sockets but I'm not sure if it will allow this two way communication. Is it feasible? Is there a better way that is cross platform and will work in most browsers? Should I be considering a Java Swing based solution that runs inside a browser?
EDIT: What about changing the code in my C++ server to add an additional interface that my Javascript code can communicate directly with it?
The WebSocket protocol differs from TCP/IP sockets. You will have to write something to link them together.
You can do this perfectly well in JavaScript: use Node.js. There's enough tutorials to be found on the subject. The best way to link it to your in-browser JS is through Socket.IO.
Create a Node.js server that connects to the api
Make the server talk to your web app
Use it :)
This will work cross-platform and cross-browser (Socket.IO can use/emulate websockets even on IE6(!!)). You'll have to run a server-app (the Node.js app) though.
My personal opinion is that if you want a web/browser based solution, you should use native technology, and not Java.
Hope this helps :)

Is HTML5 Socket.IO available in C++?

I have a server that creates a websocket. I'm using HTML5, Javascript and JQuery on the client side.
My fellow-student who works on the project uses RFID technology to scan a tag. Then he needs to send me those data from his app via the socket.
Is that possible with his preferred language C++? And how does he need to do that?
There are some websocket implementations for C++ available. See http://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations Unfortunately I don't have experience with any of them.
When none of these libraries works out for you, I would not recommend that you create your own implementation of WebSocket. It's not a very simple protocol (I know what I am talking about - I wrote a websocket server in Java) and it only makes sense when the client is a web browser. When the client is able to use pure TCP/IP sockets, like a client written in C++, there is no reason to add WebSocket as another layer of indirection.
So you should rather implement an alternative network handler on your server which listens to a normal non-web socket. That would be a lot easier and also reduce protocol overhead and CPU load on client and server.

Is there a Telnet library for JavaScript?

We have a network camera. It has an HTTP server to provides the current image. There is also a Telnet interface for controlling the camera (i.e. trigger, focus, etc.). I would like to add an HTML page to the camera that would provide a simple interface (we already have client software we write). I can "GET" the image and display that, but I would also like to have controls that use the Telnet interface to control the camera. So a button might have JavaScript code behind it that connects to the camera via Telnet (logs in) and issues the command to trigger the camera.
I know that JavaScript/browsers support connecting to the same host via XMLHttpRequest. In this case I would be looking to open a socket on port 23 and send text. I also know that I can do this through Flash, Java, or some other technology, but I would prefer to use JavaScript only. If that is possible.
Thomaschaaf is correct, while HTML5 introduces websockets you'll find they still require special server support as they post HTTP style information upon opening the socket:
JS/HTML5 WebSocket: Connect without HTTP call
The best way, currently, to have true sockets is to either
use a flash or Java component on the webpage that does the actual socket work.
use a proxy server with websockets that can handle the additional protocol overhead of websockets and connect to the real tcp/ip port with plain sockets.
The jsterm example Matt linked does the latter, and if your webcans are behind a firewall it will not work in your situation without also implementing another server.
There are libraries that implement the first method, two are linked here for convenience, many others can be found using a search engine:
http://stephengware.com/proj/javasocketbridge/ (Java)
http://matthaynes.net/blog/2008/07/17/socketbridge-flash-javascript-socket-bridge/ (Flash)
jsTerm is an HTML5 implementation of a Telnet client.
You'll need a browser that supports HTML5 WebSockets. WebSockets is the only method of doing non-HTTP requests with pure JavaScript.
Currently there is no way to do socket connections with JavaScript only.
But what you are searching for is a socket connection ;)
https://developer.mozilla.org/en/XML_Extras
If I interpret the question liberally as "is there a remote connectivity library for Javascript", then the answer is yes (quoting from https://xtermjs.org/):
A web based SSH2 client using xterm.js, socket.io, and ssh2: https://github.com/billchurch/WebSSH2
HTML5 Based SSHv2 Web Client with E2E encryption utilising xterm.js, SJCL & websockets: https://github.com/stuicey/SSHy
I've tried WebSSH2 with node.js briefly, it worked for me - I managed to connect to a Linux-based server with it.
(I know this probably doesn't help the OP but this is a 7-year old question anyway. Maybe it helps others who are needing an answer to a similar problem.)

Categories