最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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.

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.

Share Improve this question asked Jun 22, 2012 at 21:00 xchg.caxchg.ca 1,1642 gold badges15 silver badges28 bronze badges
Add a comment  | 

6 Answers 6

Reset to default 8

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.

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.

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

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

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.

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

Samy Kamkar gave a black hat talk about this.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论