Skip to content

Commit

Permalink
Use TransportName values when setting transports’ shortName
Browse files Browse the repository at this point in the history
Preparation for #1394 (making transports tree-shakable).
  • Loading branch information
lawrence-forooghian committed Nov 7, 2023
1 parent 336bc9c commit da87214
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/common/lib/transport/websockettransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import ErrorInfo from '../types/errorinfo';
import NodeWebSocket from 'ws';
import ConnectionManager, { TransportParams } from './connectionmanager';
import Auth from '../client/auth';
import TransportName from 'common/constants/TransportName';

const shortName = 'web_socket';
const shortName = TransportName.WebSocket;

function isNodeWebSocket(ws: WebSocket | NodeWebSocket): ws is NodeWebSocket {
return !!(ws as NodeWebSocket).on;
Expand Down
3 changes: 2 additions & 1 deletion src/platform/nodejs/lib/transport/nodecomettransport.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import http from 'http';
import https from 'https';
import url from 'url';
import util from 'util';
import TransportName from '../../../../common/constants/TransportName';

var NodeCometTransport = function (connectionManager) {
var noop = function () {};
var shortName = 'comet';
var shortName = TransportName.Comet;

/*
* A transport to use with nodejs
Expand Down
3 changes: 2 additions & 1 deletion src/platform/web/lib/transport/xhrpollingtransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import XHRRequest from './xhrrequest';
import ConnectionManager, { TransportParams } from 'common/lib/transport/connectionmanager';
import Auth from 'common/lib/client/auth';
import { RequestParams } from 'common/types/http';
import TransportName from 'common/constants/TransportName';

var shortName = 'xhr_polling';
var shortName = TransportName.XhrPolling;
class XHRPollingTransport extends CometTransport {
shortName = shortName;
constructor(connectionManager: ConnectionManager, auth: Auth, params: TransportParams) {
Expand Down
3 changes: 2 additions & 1 deletion src/platform/web/lib/transport/xhrstreamingtransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import XHRRequest from './xhrrequest';
import ConnectionManager, { TransportParams } from 'common/lib/transport/connectionmanager';
import Auth from 'common/lib/client/auth';
import { RequestParams } from 'common/types/http';
import TransportName from 'common/constants/TransportName';

const shortName = 'xhr_streaming';
const shortName = TransportName.XhrStreaming;
class XHRStreamingTransport extends CometTransport {
shortName = shortName;
constructor(connectionManager: ConnectionManager, auth: Auth, params: TransportParams) {
Expand Down

0 comments on commit da87214

Please sign in to comment.