Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

reanimate

import { reanimate } from "https://gitlab.com/soapbox-pub/nostr-machina/-/raw/main/mod.ts";

Keep the WebSocket connected. When closed, a new socket is created.

By default, it uses exponential backoff with a 1 second delay. You can change this behavior by passing in a backoff function and delay value.

@example
const socket = new WebSocket('wss://example.com');

reanimate(socket, (nextsocket) => {
  // socket is reanimated
  handleSocket(socket);
});
function reanimate(
socket: WebSocket,
cb: (socket: WebSocket) => unknown,
): void;
§
reanimate(socket: WebSocket, cb: (socket: WebSocket) => unknown, opts?: ReanimateOpts): void
[src]

§Parameters

§
socket: WebSocket
[src]
§
cb: (socket: WebSocket) => unknown
[src]
§
opts?: ReanimateOpts optional
[src]

§Return Type