xchg.ca
xchg.ca

Reputation: 1164

Can I connect to irc, icq, sip, etc services using WebSockets providing I have some sort implementation of those protocols in JavaScript?

I would like to connect to to irc, icq, sip, etc services using WebSockets. Assuming I have some sort implementation of those protocols in JavaScript ? Is that possible? I don't seems to understand limitations of WebSockets comparing to regular sockets.

Upvotes: 6

Views: 5822

Answers (6)

Zach Bloomquist
Zach Bloomquist

Reputation: 5881

Since 2021, there is a (draft) standard for IRC over WebSockets by the IRCv3 working group: https://ircv3.net/specs/extensions/websocket

Each IRC message is contained in a separate WebSocket message, instead of being delimited by CRLF. This is a similar approach to the other answers here and UnrealIRCd's m_websocket.

Libera.Chat and Snoonet are two networks that currently support IRCv3 websockets. Both are currently locked down to allow only specific HTTP origins to curb abuse potential.

Upvotes: 0

A T
A T

Reputation: 13846

Extending on @kanaka's websockify, this project seems to do it:

A HTML5 irc-client, made with websocket and websockify.

[Has] support for autojoin, privmsg channel, topic, join, userlist, part, nick.

https://github.com/confact/dunirc

Upvotes: 0

Jamezs Gladney
Jamezs Gladney

Reputation: 116

Inspircd has an unofficial module you can install called m_websockets, to allow connection. A server that has the module installed and setup will allow you to connect to the server via webbsockets.

https://github.com/barosl/inspircd-m_websocket

Upvotes: 1

0xcaff
0xcaff

Reputation: 13681

No, not with websockets, but you can with http.

Samy Kamkar gave a black hat talk about this.

Upvotes: -1

kanaka
kanaka

Reputation: 73217

Absolutely!

The caveat is that you need something to bridge between the WebSocket transport protocol of the browser and the raw TCP socket of the existing service. For example, something like websockify (disclaimer: I created websockify). Another caveat is that websockify only supports TCP targets (WebSocket is TCP only right now so supporting UDP targets would be a little odd anyways).

The websockify project actually includes two proof of concept HTML/Javascript pages to communicate with IRC and telnet. If you are interested in leveraging websockify to build HTML/Javascript clients for some common TCP protocols, I might even pull them into the websockify repo as examples (assuming they are well coded and under an open source license.

An alternative to websockify is to integrate websocket server-side support directly into the servers you wish to communicate with. It's not all that difficult to add support. WebSocket has a very simple framing and while the handshake is compatible with HTTP servers it's actually much more restricted and simple and doesn't require a full HTTP parser. For example, libvncserver 0.9.9 now supports both regular VNC connections and VNC connections over WebSocket. This allows noVNC (which I also created) to connect directly to a libvncserver based VNC server without requiring websockify.

Upvotes: 8

Alnitak
Alnitak

Reputation: 339985

No, you can't, at least not directly.

WebSockets allow real-time messaging between a browser and a WebSocket server, but they have their own layer 7 protocol for encapsulating those messages.

They don't provide access to a pure TCP (or UDP) socket over which you can implement existing protocols.

Upvotes: 8

Related Questions