source: trip-planner-front/node_modules/sockjs-client/lib/transport/jsonp-polling.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1016 bytes
Line 
1'use strict';
2
3// The simplest and most robust transport, using the well-know cross
4// domain hack - JSONP. This transport is quite inefficient - one
5// message could use up to one http request. But at least it works almost
6// everywhere.
7// Known limitations:
8// o you will get a spinning cursor
9// o for Konqueror a dumb timer is needed to detect errors
10
11var inherits = require('inherits')
12 , SenderReceiver = require('./lib/sender-receiver')
13 , JsonpReceiver = require('./receiver/jsonp')
14 , jsonpSender = require('./sender/jsonp')
15 ;
16
17function JsonPTransport(transUrl) {
18 if (!JsonPTransport.enabled()) {
19 throw new Error('Transport created when disabled');
20 }
21 SenderReceiver.call(this, transUrl, '/jsonp', jsonpSender, JsonpReceiver);
22}
23
24inherits(JsonPTransport, SenderReceiver);
25
26JsonPTransport.enabled = function() {
27 return !!global.document;
28};
29
30JsonPTransport.transportName = 'jsonp-polling';
31JsonPTransport.roundTrips = 1;
32JsonPTransport.needBody = true;
33
34module.exports = JsonPTransport;
Note: See TracBrowser for help on using the repository browser.