$connection
Updated on Aug 21, 2025 2 minutes to readThe Connection Plugin provides a unified interface to create, manage, and interact with different connection protocols.
Methods
Method | Description |
---|---|
generateWebSocketUrl | Generates a new URL for connecting to a WebSocket server. |
SFTP | Creates a new SFTP connection. |
Methods Details
generateWebSocketUrl()
• Type
(config: WebSocketUrlConfig) => string
• Details
Expects a WebSocketUrlConfig.
Returns a string containing the generated URL for connecting to a WebSocket server.
• Example
const wsUrl = E8App.$connection.generateWebSocketUrl({
topic: 'chat-room-1',
identity: { userId: 'user123' },
expiresIn: 3600
});
// wsUrl now contains the URL for WebSocket connection
SFTP()
• Type
(config: SFTPConnectionConfig) => SFTPConnection
• Details
Expects an SFTPConnectionConfig.
Returns an SFTPConnection instance for interacting with the SFTP server.
• Example
const sftp = E8App.$connection.SFTP({
host: 'sftp.example.com',
port: 22,
timeout: 5000
});
const loggedIn = sftp.login('username', 'password');
// loggedIn indicates if authentication succeeded
const currentDir = sftp.getCurrentDirectory();
// currentDir contains the current directory or false if failed
const fileList = sftp.getList();
// fileList contains the list of files or false if failed