Project

General

Profile

Feature #798

Add Irccd.Socket API

Added by David Demelier about 1 year ago.

Status:
New
Priority:
Normal
Category:
libirccd-js
Target version:
Start date:
04/16/2018
Due date:
% Done:

0%

Estimated time:
8.00 h
MFD after:
MFD revision:
Branch:
default
Bookmark:
@
Platform:

Description

Create an asynchronous Irccd.Socket API for communicating with internet and local sockets.

Server class

This object only have one function for accepting clients.

  • Server(options): create a server object,
  • Server.prototype.accept(handler): wait for a client and call the handler.

Socket class

  • Socket(type): create a socket,
  • Socket.prototype.connect(options, handler): connect to the given endpoint,
  • Socket.prototype.write(data, handler): write some data to the socket,
  • Socket.prototype.read(amount, handler): read some data from the socket,
  • Socket.prototype.readline(delimiter, handler): convenient handler that reads until a delimiter,
  • Socket.prototype.close(handler = null): close gracefully the socket.

Also available in: Atom PDF