-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We expose WebSocketTransport, XHRPolling, and XHRStreaming modules. Resolves #1394.
- Loading branch information
1 parent
7cb13b9
commit 23c83d9
Showing
13 changed files
with
206 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import { TransportNames } from 'common/constants/TransportName'; | ||
import initialiseNodeCometTransport from './nodecomettransport'; | ||
import { default as initialiseWebSocketTransport } from '../../../../common/lib/transport/websockettransport'; | ||
|
||
export default { | ||
order: [TransportNames.Comet], | ||
implementations: { [TransportNames.Comet]: initialiseNodeCometTransport }, | ||
bundledImplementations: { | ||
[TransportNames.WebSocket]: initialiseWebSocketTransport, | ||
[TransportNames.Comet]: initialiseNodeCometTransport, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
import { TransportNames } from 'common/constants/TransportName'; | ||
import TransportName from 'common/constants/TransportName'; | ||
import Platform from 'common/platform'; | ||
import initialiseXHRPollingTransport from './xhrpollingtransport'; | ||
import initialiseXHRStreamingTransport from './xhrstreamingtransport'; | ||
import { default as initialiseWebSocketTransport } from '../../../../common/lib/transport/websockettransport'; | ||
|
||
export default { | ||
order: [TransportNames.XhrPolling, TransportNames.XhrStreaming], | ||
implementations: { | ||
[TransportNames.XhrPolling]: initialiseXHRPollingTransport, | ||
[TransportNames.XhrStreaming]: initialiseXHRStreamingTransport, | ||
// For reasons that I don’t understand, if we use [TransportNames.XhrStreaming] and [TransportNames.XhrPolling] for the keys in defaultTransports’s, then defaultTransports does not get tree-shaken. Hence using literals instead. They’re still correctly type-checked. | ||
|
||
const order: TransportName[] = ['xhr_polling', 'xhr_streaming']; | ||
|
||
const defaultTransports: (typeof Platform)['Transports'] = { | ||
order, | ||
bundledImplementations: { | ||
web_socket: initialiseWebSocketTransport, | ||
xhr_polling: initialiseXHRPollingTransport, | ||
xhr_streaming: initialiseXHRStreamingTransport, | ||
}, | ||
}; | ||
|
||
export default defaultTransports; | ||
|
||
export const ModulesTransports: (typeof Platform)['Transports'] = { | ||
order, | ||
bundledImplementations: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { default as XHRPolling } from '../lib/transport/xhrpollingtransport'; | ||
export { default as XHRStreaming } from '../lib/transport/xhrstreamingtransport'; | ||
export { default as WebSocketTransport } from '../../../common/lib/transport/websockettransport'; |
Oops, something went wrong.