Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

possible web protocols in javascript

What are the alternatives to HTTP (per XMLHttpRequest) when establishing a server connection in JavaScript? The only one I know is the WebSocket protocol (per WebSocket). Their corresponding secure variants https and wss included.

Would it be possible to choose an arbitrary protocol with JavaScript? How do you communicate with NTP, IMAP, UDP etc. -services for example in Node.js?

like image 764
Bergi Avatar asked Jun 05 '12 17:06

Bergi


People also ask

What are Javascript protocols?

What is Protocol? A network protocol defines rules and conventions for communication between network devices. By adopting these rules, two devices can communicate with each other and can interchange the information.

What are the different types of web protocols?

Common Internet protocols include TCP/IP (Transmission Control Protocol/Internet Protocol), UDP/IP (User Datagram Protocol/Internet Protocol), HTTP (HyperText Transfer Protocol) and FTP (File Transfer Protocol). TCP/IP is a stream protocol. This means that a connection is negotiated between a client and a server.

What are the 3 types of protocol?

Generally speaking, there are three types of protocols in networking -- communication, such as Ethernet; management, such as Simple Mail Transfer Protocol (SMTP); and security, such as Secure Shell, or SSH.


1 Answers

From Node.js, you can do pretty much anything. E.g. UDP is directly supported (dgram module which is shipped with node.js), and npm has a plethora of third-party modules for many other protocols, such as SMTP, IMAP, FTP and XMPP; see https://github.com/joyent/node/wiki/Modules for one list. And if you can't find a ready made module for your favorite protocol, you can implement one yourself.

Now when it comes to browsers, you are much more limited. Those you listed are all I know (browser plugins excluded, of course). So you'd need to connect to a proxy server with HTTP(S) or ws(s) and do the actual protocol stuff from there.

like image 101
Tapio Avatar answered Sep 30 '22 00:09

Tapio