This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.
listen method is used to listen on a given port on the device.
var instanceOfTCPServerSocket = navigator.mozTCPSocket.listen(port[, options[, backlog]]);
- A number representing the port the server socket is listening on. Pass -1 to indicate no preference, and a port will be selected automatically.
An object specifying the details of the socket. This object expects the following property:
- A number representing the maximum length the queue of pending connections may grow to. This parameter may be silently limited by the operating system. Pass -1 to use the default value.
It returns a new
TCPServerSocket object listening on the provided