Skip to content

Commit

Permalink
Avoid using nodejs globals that would need to get shimmed.
Browse files Browse the repository at this point in the history
  • Loading branch information
legastero committed Apr 18, 2019
1 parent 6442ef5 commit 3e4327e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/plugins/jingle.js
Expand Up @@ -2,9 +2,10 @@ import * as Jingle from '../jingle';
import { Namespaces } from '../protocol';

let root;
try {
if (typeof window !== 'undefined') {
root = window;
} catch (err) {
}
if (typeof global !== 'undefined') {
root = global;
}

Expand All @@ -18,7 +19,7 @@ export default function(client) {
};

client.disco.addFeature(Namespaces.JINGLE_1);
if (root.RTCPeerConnection) {
if (root && root.RTCPeerConnection) {
const caps = [
Namespaces.JINGLE_RTP_1,
Namespaces.JINGLE_RTP_RTCP_FB_0,
Expand Down
8 changes: 7 additions & 1 deletion src/transports/bosh.js
Expand Up @@ -158,7 +158,13 @@ export default class BOSHConnection extends WildEmitter {
const self = this;
if (self.hasStream) {
self.sendQueue.push(data);
process.nextTick(self.longPoll.bind(self));
// Schedule polling to send the data just a little
// bit into the future so we have time for multiple
// sends to get batched.
clearTimeout(this.pollTimeout);
this.pollTimeout = setTimeout(() => {
self.longPoll();
}, 50);
}
}

Expand Down

0 comments on commit 3e4327e

Please sign in to comment.