Server : nginx/1.18.0 System : Linux localhost 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64 User : www-data ( 33) PHP Version : 8.0.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/ecommerce/node_modules/pusher-js/src/core/transports/ |
import Factory from '../utils/factory';
import TransportHooks from './transport_hooks';
import TransportConnection from './transport_connection';
import TransportConnectionOptions from './transport_connection_options';
/** Provides interface for transport connection instantiation.
*
* Takes transport-specific hooks as the only argument, which allow checking
* for transport support and creating its connections.
*
* Supported hooks: * - file - the name of the file to be fetched during initialization
* - urls - URL scheme to be used by transport
* - handlesActivityCheck - true when the transport handles activity checks
* - supportsPing - true when the transport has a ping/activity API
* - isSupported - tells whether the transport is supported in the environment
* - getSocket - creates a WebSocket-compatible transport socket
*
* See transports.js for specific implementations.
*
* @param {Object} hooks object containing all needed transport hooks
*/
export default class Transport {
hooks: TransportHooks;
constructor(hooks: TransportHooks) {
this.hooks = hooks;
}
/** Returns whether the transport is supported in the environment.
*
* @param {Object} envronment te environment details (encryption, settings)
* @returns {Boolean} true when the transport is supported
*/
isSupported(environment: any): boolean {
return this.hooks.isSupported(environment);
}
/** Creates a transport connection.
*
* @param {String} name
* @param {Number} priority
* @param {String} key the application key
* @param {Object} options
* @returns {TransportConnection}
*/
createConnection(
name: string,
priority: number,
key: string,
options: any
): TransportConnection {
return new TransportConnection(this.hooks, name, priority, key, options);
}
}