0.0.1-rc2 • Published 1 year ago

@qsocket/transport v0.0.1-rc2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@qsocket/transport

npm version npm downloads GitHub license

@qsocket/transport is a unified package that bundles multiple transport modules for the qsocket library, providing compatibility with different versions of engine.io and engine.io-client. This package allows you to easily access all supported qsocket transports in one place, enabling seamless integration and compatibility across various environments.

Included Transports

The @qsocket/transport package includes the following transport modules:

Installation

To install the @qsocket/transport package, run:

npm install @qsocket/transport

Note: It is recommended to use this library in conjunction with @qsocket/core for full functionality, or in cases where your project requires multiple versions of the same transport library.

Usage

Here’s how you can import and use the various transports provided by @qsocket/transport:

import {
	QSocketTransportEIOLatestServer,
	QSocketTransportEIOV3Server,
	QSocketTransportEIOClientLatestSocket,
	QSocketTransportEIOClientV3Socket,
} from '@qsocket/transport';

// Example usage with qsocket core
import { QSocketServer, QSocketClient } from '@qsocket/core';

// Set up a server with the latest version of engine.io transport
const modernServer = new QSocketServer({
	transport: new QSocketTransportEIOLatestServer(/** Configurations */),
	// Here, you can pass specific configurations for engine.io-latest
});

// Set up a server with version 3 of engine.io transport for legacy support
const legacyServer = new QSocketServer({
	transport: new QSocketTransportEIOV3Server(/** Configurations */),
	// This configuration supports legacy environments requiring engine.io v3
});

// Set up a client using the latest version of engine.io-client transport
const modernClient = new QSocketClient({
	transport: new QSocketTransportEIOClientLatestSocket(/** Configurations */),
	// This configuration utilizes the latest engine.io-client features
});

// Set up a client with engine.io-client v3 transport for compatibility with older versions
const legacyClient = new QSocketClient({
	transport: new QSocketTransportEIOClientV3Socket(/** Configurations */),
	// This setup enables legacy client support with engine.io-client v3
});

Each transport module can be passed to QSocket's transport option, allowing you to customize your connection based on the environment and version requirements.

Documentation

For more detailed information on each individual transport, please refer to the respective package documentation:

License

This project is licensed under the MIT License.