Skip to main content
Module

x/denops_std/function/nvim/mod.ts>sockconnect

📚 Standard module for denops.vim
Go to Latest
function sockconnect
import { sockconnect } from "https://deno.land/x/denops_std@v6.4.0/function/nvim/mod.ts";

Connect a socket to an address. If {mode} is "pipe" then {address} should be the path of a local domain socket (on unix) or named pipe (on Windows). If {mode} is "tcp" then {address} should be of the form "host:port" where the host should be an ip adderess or host name, and port the port number.

For "pipe" mode, see luv-pipe-handle. For "tcp" mode, see luv-tcp-handle.

Returns a channel ID. Close the socket with chanclose(). Use chansend() to send data over a bytes socket, and rpcrequest() and rpcnotify() to communicate with a RPC socket.

{opts} is an optional dictionary with these keys: on_data : callback invoked when data was read from socket data_buffered : read socket data in channel-buffered mode. rpc : If set, msgpack-rpc will be used to communicate over the socket. Returns:

  • The channel ID on success (greater than zero)
  • 0 on invalid arguments or connection failure.

Parameters

denops: Denops
mode: unknown
address: unknown
optional
opts: unknown

Returns

Promise<number>