laravel-echo
Version:
Laravel Echo library for beautiful Pusher, Socket.IO, and Mercure integration
70 lines (69 loc) • 2.11 kB
TypeScript
import type { SocketIoFunction, SocketIoSocket as Socket } from "../socketio-types";
import { SocketIoChannel, SocketIoPresenceChannel, SocketIoPrivateChannel } from "../channel";
import type { ConnectionStatus } from "../echo";
import { Connector } from "./connector";
type AnySocketIoChannel = SocketIoChannel | SocketIoPrivateChannel | SocketIoPresenceChannel;
/**
* This class creates a connector to a Socket.io server.
*/
export declare class SocketIoConnector extends Connector<"socket.io", SocketIoChannel, SocketIoPrivateChannel, SocketIoPresenceChannel> {
/**
* The Socket.io connection instance.
*/
socket: Socket;
/**
* All of the subscribed channel names.
*/
channels: {
[]: SocketIoChannel;
};
/**
* Create a fresh Socket.io connection.
*/
connect(): void;
/**
* Get socket.io module from global scope or options.
*/
getSocketIO(): SocketIoFunction;
/**
* Listen for an event on a channel instance.
*/
listen(name: string, event: string, callback: CallableFunction): AnySocketIoChannel;
/**
* Get a channel instance by name.
*/
channel(name: string): AnySocketIoChannel;
/**
* Get a private channel instance by name.
*/
privateChannel(name: string): SocketIoPrivateChannel;
/**
* Get a presence channel instance by name.
*/
presenceChannel(name: string): SocketIoPresenceChannel;
/**
* Leave the given channel, as well as its private and presence variants.
*/
leave(name: string): void;
/**
* Leave the given channel.
*/
leaveChannel(name: string): void;
/**
* Get the socket ID for the connection.
*/
socketId(): string | undefined;
/**
* Get the current connection status.
*/
connectionStatus(): ConnectionStatus;
/**
* Subscribe to connection status changes.
*/
onConnectionChange(callback: (status: ConnectionStatus) => void): () => void;
/**
* Disconnect Socketio connection.
*/
disconnect(): void;
}
export {};