Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/grm/deps.ts>Socket#connect

MTProto API Client for Deno 🦕
Go to Latest
method Socket.prototype.connect
import { Socket } from "https://deno.land/x/grm@v0.3.1/deps.ts";

Initiate a connection on a given socket.

Possible signatures:

  • socket.connect(options[, connectListener])
  • socket.connect(path[, connectListener]) for IPC connections.
  • socket.connect(port[, host][, connectListener]) for TCP connections.
  • Returns: net.Socket The socket itself.

This function is asynchronous. When the connection is established, the "connect" event will be emitted. If there is a problem connecting, instead of a "connect" event, an "error" event will be emitted with the error passed to the "error" listener. The last parameter connectListener, if supplied, will be added as a listener for the "connect" event once.

This function should only be used for reconnecting a socket after "close" has been emitted or otherwise it may lead to undefined behavior.

Parameters

options: SocketConnectOptions | NormalizedArgs
optional
connectionListener: ConnectionListener

Parameters

port: number
host: string
optional
connectionListener: ConnectionListener

Parameters

port: number
optional
connectionListener: ConnectionListener

Parameters

path: string
optional
connectionListener: ConnectionListener