pingerchips-js 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -655
- package/index.js +169 -0
- package/package.json +20 -59
- package/.editorconfig +0 -14
- package/.github/ISSUE_TEMPLATE.md +0 -11
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- package/.github/dependabot.yml +0 -14
- package/.github/stale.yml +0 -26
- package/.github/workflows/release.yml +0 -112
- package/.github/workflows/release_pr.yml +0 -43
- package/.github/workflows/run-tests.yml +0 -62
- package/.gitmodules +0 -3
- package/.prettierrc +0 -2
- package/CHANGELOG.md +0 -924
- package/LICENCE +0 -19
- package/Makefile +0 -78
- package/bower.json +0 -28
- package/dist/node/pusher.js +0 -10870
- package/dist/node/pusher.js.map +0 -1
- package/dist/react-native/pusher.js +0 -9
- package/dist/react-native/pusher.js.map +0 -1
- package/dist/web/json2.js +0 -486
- package/dist/web/json2.min.js +0 -1
- package/dist/web/pusher-with-encryption.js +0 -7009
- package/dist/web/pusher-with-encryption.js.map +0 -1
- package/dist/web/pusher-with-encryption.min.js +0 -9
- package/dist/web/pusher-with-encryption.min.js.map +0 -1
- package/dist/web/pusher.js +0 -4587
- package/dist/web/pusher.js.map +0 -1
- package/dist/web/pusher.min.js +0 -9
- package/dist/web/pusher.min.js.map +0 -1
- package/dist/web/sockjs.js +0 -2435
- package/dist/web/sockjs.min.js +0 -89
- package/dist/worker/pusher-with-encryption.worker.js +0 -6622
- package/dist/worker/pusher-with-encryption.worker.js.map +0 -1
- package/dist/worker/pusher-with-encryption.worker.min.js +0 -9
- package/dist/worker/pusher-with-encryption.worker.min.js.map +0 -1
- package/dist/worker/pusher.worker.js +0 -4200
- package/dist/worker/pusher.worker.js.map +0 -1
- package/dist/worker/pusher.worker.min.js +0 -9
- package/dist/worker/pusher.worker.min.js.map +0 -1
- package/index.d.ts +0 -29
- package/integration_tests_server/index.js +0 -176
- package/integration_tests_server/package-lock.json +0 -1177
- package/integration_tests_server/package.json +0 -15
- package/node.js +0 -1
- package/pusher-with-encryption/index.js +0 -1
- package/react-native/index.d.ts +0 -29
- package/react-native/index.js +0 -1
- package/spec/config/jasmine/helpers/reporter.js +0 -14
- package/spec/config/jasmine/integration.json +0 -13
- package/spec/config/jasmine/unit.json +0 -13
- package/spec/config/jasmine/webpack.integration.js +0 -33
- package/spec/config/jasmine/webpack.unit.js +0 -30
- package/spec/config/karma/available_browsers.json +0 -4957
- package/spec/config/karma/config.ci.js +0 -25
- package/spec/config/karma/config.common.js +0 -50
- package/spec/config/karma/config.integration.js +0 -26
- package/spec/config/karma/config.unit.js +0 -10
- package/spec/config/karma/config.worker.js +0 -34
- package/spec/config/karma/integration.js +0 -24
- package/spec/config/karma/unit.js +0 -20
- package/spec/javascripts/helpers/mocks.js +0 -274
- package/spec/javascripts/helpers/node/integration.js +0 -33
- package/spec/javascripts/helpers/node/mock-dom-dependencies.ts +0 -1
- package/spec/javascripts/helpers/pusher_integration.js +0 -1
- package/spec/javascripts/helpers/pusher_integration_class.ts +0 -12
- package/spec/javascripts/helpers/timers/promises.js +0 -9
- package/spec/javascripts/helpers/waitsFor.js +0 -37
- package/spec/javascripts/helpers/web/integration.js +0 -44
- package/spec/javascripts/helpers/worker/mock-dom-dependencies.js +0 -1
- package/spec/javascripts/integration/core/cluster_config_spec.js +0 -153
- package/spec/javascripts/integration/core/falling_back_spec.js +0 -195
- package/spec/javascripts/integration/core/pusher_spec/index.js +0 -68
- package/spec/javascripts/integration/core/pusher_spec/test_builder.js +0 -715
- package/spec/javascripts/integration/core/timeout_configuration_spec.js +0 -200
- package/spec/javascripts/integration/core/transport_lists_spec.js +0 -103
- package/spec/javascripts/integration/index.node.js +0 -12
- package/spec/javascripts/integration/index.web.js +0 -63
- package/spec/javascripts/integration/index.worker.js +0 -13
- package/spec/javascripts/integration/web/dom/jsonp_spec.js +0 -97
- package/spec/javascripts/integration/web/dom/script_request_spec.js +0 -90
- package/spec/javascripts/polyfills/index.js +0 -105
- package/spec/javascripts/unit/core/channels/channel_spec.js +0 -355
- package/spec/javascripts/unit/core/channels/channels_spec.js +0 -94
- package/spec/javascripts/unit/core/channels/encrypted_channel_spec.js +0 -343
- package/spec/javascripts/unit/core/channels/presence_channel_spec.js +0 -553
- package/spec/javascripts/unit/core/channels/private_channel_spec.js +0 -182
- package/spec/javascripts/unit/core/config_spec.js +0 -507
- package/spec/javascripts/unit/core/connection/connection_manager_spec.js +0 -656
- package/spec/javascripts/unit/core/connection/connection_spec.js +0 -286
- package/spec/javascripts/unit/core/connection/handshake_spec.js +0 -160
- package/spec/javascripts/unit/core/connection/protocol_spec.js +0 -420
- package/spec/javascripts/unit/core/defaults_spec.js +0 -26
- package/spec/javascripts/unit/core/events_dispatcher_spec.js +0 -385
- package/spec/javascripts/unit/core/http/http_polling_socket_spec.js +0 -60
- package/spec/javascripts/unit/core/http/http_request_spec.js +0 -185
- package/spec/javascripts/unit/core/http/http_socket_spec.js +0 -370
- package/spec/javascripts/unit/core/http/http_streaming_socket_spec.js +0 -56
- package/spec/javascripts/unit/core/http/http_xhr_request_spec.js +0 -164
- package/spec/javascripts/unit/core/logger_spec.js +0 -133
- package/spec/javascripts/unit/core/pusher_spec.js +0 -613
- package/spec/javascripts/unit/core/pusher_with_encryption_spec.js +0 -18
- package/spec/javascripts/unit/core/strategies/best_connected_ever_strategy_spec.js +0 -104
- package/spec/javascripts/unit/core/strategies/delayed_strategy_spec.js +0 -95
- package/spec/javascripts/unit/core/strategies/first_connected_strategy_spec.js +0 -68
- package/spec/javascripts/unit/core/strategies/if_strategy_spec.js +0 -165
- package/spec/javascripts/unit/core/strategies/sequential_strategy_spec.js +0 -213
- package/spec/javascripts/unit/core/strategies/transport_strategy_spec.js +0 -250
- package/spec/javascripts/unit/core/strategies/websocket_prioritized_cached_strategy_spec.js +0 -400
- package/spec/javascripts/unit/core/timeline/timeline_spec.js +0 -153
- package/spec/javascripts/unit/core/transports/assistant_to_the_transport_manager_spec.js +0 -223
- package/spec/javascripts/unit/core/transports/hosts_and_ports_spec.js +0 -85
- package/spec/javascripts/unit/core/transports/transport_connection_spec.js +0 -585
- package/spec/javascripts/unit/core/transports/transport_manager_spec.js +0 -64
- package/spec/javascripts/unit/core/user_spec.js +0 -303
- package/spec/javascripts/unit/core/utils/periodic_timer_spec.js +0 -74
- package/spec/javascripts/unit/core/utils/timers_spec.js +0 -157
- package/spec/javascripts/unit/core/utils/url_store_spec.js +0 -14
- package/spec/javascripts/unit/core/watchlist_spec.js +0 -48
- package/spec/javascripts/unit/core_with_runtime/auth/channel_authorizer_spec.js +0 -137
- package/spec/javascripts/unit/core_with_runtime/auth/deprecated_channel_authorizer_spec.js +0 -48
- package/spec/javascripts/unit/core_with_runtime/auth/user_authorizer_spec.js +0 -128
- package/spec/javascripts/unit/core_with_runtime/readme.md +0 -5
- package/spec/javascripts/unit/index.node.js +0 -11
- package/spec/javascripts/unit/index.web.js +0 -12
- package/spec/javascripts/unit/index.worker.js +0 -11
- package/spec/javascripts/unit/isomorphic/transports/hosts_and_ports_spec.js +0 -82
- package/spec/javascripts/unit/isomorphic/transports/transports_spec.js +0 -202
- package/spec/javascripts/unit/node/timeline_sender_spec.js +0 -83
- package/spec/javascripts/unit/web/dom/dependency_loader_spec.js +0 -249
- package/spec/javascripts/unit/web/dom/jsonp_request_spec.js +0 -130
- package/spec/javascripts/unit/web/dom/script_receiver_factory_spec.js +0 -68
- package/spec/javascripts/unit/web/http/http_xdomain_request_spec.js +0 -222
- package/spec/javascripts/unit/web/pusher_authorizer_spec.js +0 -64
- package/spec/javascripts/unit/web/timeline/timeline_sender_spec.js +0 -131
- package/spec/javascripts/unit/web/transports/hosts_and_ports_spec.js +0 -127
- package/spec/javascripts/unit/web/transports/transports_spec.js +0 -444
- package/spec/javascripts/unit/worker/channel_authorizer_spec.js +0 -156
- package/spec/javascripts/unit/worker/timeline_sender_spec.js +0 -76
- package/src/core/auth/auth_transports.ts +0 -18
- package/src/core/auth/channel_authorizer.ts +0 -64
- package/src/core/auth/deprecated_channel_authorizer.ts +0 -58
- package/src/core/auth/options.ts +0 -78
- package/src/core/auth/user_authenticator.ts +0 -62
- package/src/core/base64.ts +0 -49
- package/src/core/channels/channel.ts +0 -163
- package/src/core/channels/channel_table.ts +0 -7
- package/src/core/channels/channels.ts +0 -85
- package/src/core/channels/encrypted_channel.ts +0 -149
- package/src/core/channels/members.ts +0 -80
- package/src/core/channels/metadata.ts +0 -5
- package/src/core/channels/presence_channel.ts +0 -113
- package/src/core/channels/private_channel.ts +0 -25
- package/src/core/config.ts +0 -189
- package/src/core/connection/callbacks.ts +0 -21
- package/src/core/connection/connection.ts +0 -160
- package/src/core/connection/connection_manager.ts +0 -371
- package/src/core/connection/connection_manager_options.ts +0 -14
- package/src/core/connection/handshake/handshake_payload.ts +0 -10
- package/src/core/connection/handshake/index.ts +0 -90
- package/src/core/connection/protocol/action.ts +0 -8
- package/src/core/connection/protocol/message-types.ts +0 -8
- package/src/core/connection/protocol/protocol.ts +0 -154
- package/src/core/defaults.ts +0 -66
- package/src/core/errors.ts +0 -69
- package/src/core/events/callback.ts +0 -6
- package/src/core/events/callback_registry.ts +0 -75
- package/src/core/events/callback_table.ts +0 -7
- package/src/core/events/dispatcher.ts +0 -84
- package/src/core/http/ajax.ts +0 -24
- package/src/core/http/http_factory.ts +0 -16
- package/src/core/http/http_polling_socket.ts +0 -24
- package/src/core/http/http_request.ts +0 -81
- package/src/core/http/http_socket.ts +0 -220
- package/src/core/http/http_streaming_socket.ts +0 -19
- package/src/core/http/request_hooks.ts +0 -9
- package/src/core/http/socket_hooks.ts +0 -11
- package/src/core/http/state.ts +0 -7
- package/src/core/http/url_location.ts +0 -6
- package/src/core/logger.ts +0 -53
- package/src/core/options.ts +0 -59
- package/src/core/pusher-licence.js +0 -7
- package/src/core/pusher-with-encryption.js +0 -1
- package/src/core/pusher-with-encryption.ts +0 -14
- package/src/core/pusher.js +0 -2
- package/src/core/pusher.ts +0 -249
- package/src/core/reachability.ts +0 -7
- package/src/core/socket.ts +0 -14
- package/src/core/strategies/best_connected_ever_strategy.ts +0 -81
- package/src/core/strategies/delayed_strategy.ts +0 -48
- package/src/core/strategies/first_connected_strategy.ts +0 -28
- package/src/core/strategies/if_strategy.ts +0 -34
- package/src/core/strategies/sequential_strategy.ts +0 -129
- package/src/core/strategies/strategy.ts +0 -8
- package/src/core/strategies/strategy_builder.ts +0 -67
- package/src/core/strategies/strategy_options.ts +0 -18
- package/src/core/strategies/strategy_runner.ts +0 -6
- package/src/core/strategies/transport_strategy.ts +0 -144
- package/src/core/strategies/websocket_prioritized_cached_strategy.ts +0 -157
- package/src/core/timeline/level.ts +0 -7
- package/src/core/timeline/timeline.ts +0 -90
- package/src/core/timeline/timeline_sender.ts +0 -33
- package/src/core/timeline/timeline_transport.ts +0 -11
- package/src/core/transports/assistant_to_the_transport_manager.ts +0 -104
- package/src/core/transports/ping_delay_options.ts +0 -7
- package/src/core/transports/transport.ts +0 -54
- package/src/core/transports/transport_connection.ts +0 -241
- package/src/core/transports/transport_connection_options.ts +0 -8
- package/src/core/transports/transport_hooks.ts +0 -16
- package/src/core/transports/transport_manager.ts +0 -52
- package/src/core/transports/transports_table.ts +0 -12
- package/src/core/transports/url_scheme.ts +0 -13
- package/src/core/transports/url_schemes.ts +0 -47
- package/src/core/user.ts +0 -186
- package/src/core/util.ts +0 -34
- package/src/core/utils/collections.ts +0 -353
- package/src/core/utils/factory.ts +0 -75
- package/src/core/utils/flat_promise.ts +0 -10
- package/src/core/utils/timers/abstract_timer.ts +0 -39
- package/src/core/utils/timers/index.ts +0 -39
- package/src/core/utils/timers/scheduling.ts +0 -11
- package/src/core/utils/timers/timed_callback.ts +0 -5
- package/src/core/utils/url_store.ts +0 -48
- package/src/core/watchlist.ts +0 -31
- package/src/d.ts/constants/index.d.ts +0 -5
- package/src/d.ts/faye-websocket/faye-websocket.d.ts +0 -21
- package/src/d.ts/global/global.d.ts +0 -1
- package/src/d.ts/module/module.d.ts +0 -12
- package/src/d.ts/tweetnacl-util/index.d.ts +0 -6
- package/src/d.ts/window/events.d.ts +0 -4
- package/src/d.ts/window/sockjs.d.ts +0 -3
- package/src/d.ts/window/websocket.d.ts +0 -4
- package/src/d.ts/window/xmlhttprequest.d.ts +0 -3
- package/src/runtimes/interface.ts +0 -59
- package/src/runtimes/isomorphic/auth/xhr_auth.ts +0 -90
- package/src/runtimes/isomorphic/default_strategy.ts +0 -155
- package/src/runtimes/isomorphic/http/http.ts +0 -32
- package/src/runtimes/isomorphic/http/http_xhr_request.ts +0 -35
- package/src/runtimes/isomorphic/runtime.ts +0 -62
- package/src/runtimes/isomorphic/timeline/xhr_timeline.ts +0 -50
- package/src/runtimes/isomorphic/transports/transport_connection_initializer.ts +0 -19
- package/src/runtimes/isomorphic/transports/transports.ts +0 -81
- package/src/runtimes/node/net_info.ts +0 -10
- package/src/runtimes/node/runtime.ts +0 -68
- package/src/runtimes/react-native/net_info.ts +0 -42
- package/src/runtimes/react-native/runtime.ts +0 -65
- package/src/runtimes/web/auth/jsonp_auth.ts +0 -51
- package/src/runtimes/web/browser.ts +0 -24
- package/src/runtimes/web/default_strategy.ts +0 -201
- package/src/runtimes/web/dom/dependencies.ts +0 -16
- package/src/runtimes/web/dom/dependency_loader.ts +0 -93
- package/src/runtimes/web/dom/json2.js +0 -486
- package/src/runtimes/web/dom/jsonp_request.ts +0 -52
- package/src/runtimes/web/dom/script_receiver.ts +0 -8
- package/src/runtimes/web/dom/script_receiver_factory.ts +0 -57
- package/src/runtimes/web/dom/script_request.ts +0 -85
- package/src/runtimes/web/dom/sockjs/COPYING +0 -11
- package/src/runtimes/web/dom/sockjs/Changelog +0 -147
- package/src/runtimes/web/dom/sockjs/LICENSE-MIT-SockJS +0 -19
- package/src/runtimes/web/dom/sockjs/Makefile +0 -109
- package/src/runtimes/web/dom/sockjs/README.md +0 -388
- package/src/runtimes/web/dom/sockjs/VERSION-GEN +0 -17
- package/src/runtimes/web/dom/sockjs/bin/render.coffee +0 -111
- package/src/runtimes/web/dom/sockjs/bin/run_testling.sh +0 -135
- package/src/runtimes/web/dom/sockjs/lib/all.js +0 -9
- package/src/runtimes/web/dom/sockjs/lib/dom.js +0 -185
- package/src/runtimes/web/dom/sockjs/lib/dom2.js +0 -280
- package/src/runtimes/web/dom/sockjs/lib/eventemitter.js +0 -57
- package/src/runtimes/web/dom/sockjs/lib/heartbeater.js +0 -70
- package/src/runtimes/web/dom/sockjs/lib/index.js +0 -41
- package/src/runtimes/web/dom/sockjs/lib/info.js +0 -117
- package/src/runtimes/web/dom/sockjs/lib/json2.min.js +0 -1
- package/src/runtimes/web/dom/sockjs/lib/reventtarget.js +0 -55
- package/src/runtimes/web/dom/sockjs/lib/simpleevent.js +0 -28
- package/src/runtimes/web/dom/sockjs/lib/sockjs.js +0 -288
- package/src/runtimes/web/dom/sockjs/lib/test-hooks.js +0 -16
- package/src/runtimes/web/dom/sockjs/lib/trans-iframe-eventsource.js +0 -29
- package/src/runtimes/web/dom/sockjs/lib/trans-iframe-htmlfile.js +0 -35
- package/src/runtimes/web/dom/sockjs/lib/trans-iframe-within.js +0 -100
- package/src/runtimes/web/dom/sockjs/lib/trans-iframe-xhr-polling.js +0 -30
- package/src/runtimes/web/dom/sockjs/lib/trans-iframe.js +0 -103
- package/src/runtimes/web/dom/sockjs/lib/trans-jsonp-polling.js +0 -106
- package/src/runtimes/web/dom/sockjs/lib/trans-jsonp-receiver.js +0 -116
- package/src/runtimes/web/dom/sockjs/lib/trans-polling.js +0 -44
- package/src/runtimes/web/dom/sockjs/lib/trans-receiver-eventsource.js +0 -41
- package/src/runtimes/web/dom/sockjs/lib/trans-receiver-htmlfile.js +0 -65
- package/src/runtimes/web/dom/sockjs/lib/trans-receiver-xhr.js +0 -42
- package/src/runtimes/web/dom/sockjs/lib/trans-sender.js +0 -138
- package/src/runtimes/web/dom/sockjs/lib/trans-xhr.js +0 -29
- package/src/runtimes/web/dom/sockjs/lib/utils.js +0 -297
- package/src/runtimes/web/dom/sockjs/package.json +0 -18
- package/src/runtimes/web/dom/sockjs/version +0 -1
- package/src/runtimes/web/http/http.ts +0 -8
- package/src/runtimes/web/http/http_xdomain_request.ts +0 -37
- package/src/runtimes/web/net_info.ts +0 -50
- package/src/runtimes/web/runtime.ts +0 -174
- package/src/runtimes/web/timeline/jsonp_timeline.ts +0 -34
- package/src/runtimes/web/transports/transport_connection_initializer.ts +0 -39
- package/src/runtimes/web/transports/transports.ts +0 -65
- package/src/runtimes/worker/auth/fetch_auth.ts +0 -69
- package/src/runtimes/worker/net_info.ts +0 -10
- package/src/runtimes/worker/runtime.ts +0 -75
- package/src/runtimes/worker/timeline/fetch_timeline.ts +0 -39
- package/tsconfig.json +0 -26
- package/types/spec/javascripts/helpers/node/mock-dom-dependencies.d.ts +0 -1
- package/types/spec/javascripts/helpers/pusher_integration_class.d.ts +0 -4
- package/types/src/core/auth/auth_transports.d.ts +0 -9
- package/types/src/core/auth/channel_authorizer.d.ts +0 -3
- package/types/src/core/auth/deprecated_channel_authorizer.d.ts +0 -18
- package/types/src/core/auth/options.d.ts +0 -48
- package/types/src/core/auth/user_authenticator.d.ts +0 -3
- package/types/src/core/base64.d.ts +0 -1
- package/types/src/core/channels/channel.d.ts +0 -23
- package/types/src/core/channels/channel_table.d.ts +0 -5
- package/types/src/core/channels/channels.d.ts +0 -12
- package/types/src/core/channels/encrypted_channel.d.ts +0 -15
- package/types/src/core/channels/members.d.ts +0 -14
- package/types/src/core/channels/metadata.d.ts +0 -4
- package/types/src/core/channels/presence_channel.d.ts +0 -13
- package/types/src/core/channels/private_channel.d.ts +0 -5
- package/types/src/core/config.d.ts +0 -31
- package/types/src/core/connection/callbacks.d.ts +0 -18
- package/types/src/core/connection/connection.d.ts +0 -16
- package/types/src/core/connection/connection_manager.d.ts +0 -50
- package/types/src/core/connection/connection_manager_options.d.ts +0 -11
- package/types/src/core/connection/handshake/handshake_payload.d.ts +0 -8
- package/types/src/core/connection/handshake/index.d.ts +0 -12
- package/types/src/core/connection/protocol/action.d.ts +0 -7
- package/types/src/core/connection/protocol/message-types.d.ts +0 -7
- package/types/src/core/connection/protocol/protocol.d.ts +0 -10
- package/types/src/core/defaults.d.ts +0 -26
- package/types/src/core/errors.d.ts +0 -28
- package/types/src/core/events/callback.d.ts +0 -5
- package/types/src/core/events/callback_registry.d.ts +0 -11
- package/types/src/core/events/callback_table.d.ts +0 -5
- package/types/src/core/events/dispatcher.d.ts +0 -14
- package/types/src/core/http/ajax.d.ts +0 -16
- package/types/src/core/http/http_factory.d.ts +0 -13
- package/types/src/core/http/http_polling_socket.d.ts +0 -3
- package/types/src/core/http/http_request.d.ts +0 -17
- package/types/src/core/http/http_socket.d.ts +0 -32
- package/types/src/core/http/http_streaming_socket.d.ts +0 -3
- package/types/src/core/http/request_hooks.d.ts +0 -6
- package/types/src/core/http/socket_hooks.d.ts +0 -8
- package/types/src/core/http/state.d.ts +0 -6
- package/types/src/core/http/url_location.d.ts +0 -5
- package/types/src/core/logger.d.ts +0 -11
- package/types/src/core/options.d.ts +0 -34
- package/types/src/core/pusher-with-encryption.d.ts +0 -5
- package/types/src/core/pusher.d.ts +0 -49
- package/types/src/core/reachability.d.ts +0 -5
- package/types/src/core/socket.d.ts +0 -12
- package/types/src/core/strategies/best_connected_ever_strategy.d.ts +0 -10
- package/types/src/core/strategies/delayed_strategy.d.ts +0 -15
- package/types/src/core/strategies/first_connected_strategy.d.ts +0 -8
- package/types/src/core/strategies/if_strategy.d.ts +0 -10
- package/types/src/core/strategies/sequential_strategy.d.ts +0 -16
- package/types/src/core/strategies/strategy.d.ts +0 -6
- package/types/src/core/strategies/strategy_builder.d.ts +0 -5
- package/types/src/core/strategies/strategy_options.d.ts +0 -16
- package/types/src/core/strategies/strategy_runner.d.ts +0 -5
- package/types/src/core/strategies/transport_strategy.d.ts +0 -15
- package/types/src/core/strategies/websocket_prioritized_cached_strategy.d.ts +0 -20
- package/types/src/core/timeline/level.d.ts +0 -6
- package/types/src/core/timeline/timeline.d.ts +0 -25
- package/types/src/core/timeline/timeline_sender.d.ts +0 -13
- package/types/src/core/timeline/timeline_transport.d.ts +0 -6
- package/types/src/core/transports/assistant_to_the_transport_manager.d.ts +0 -14
- package/types/src/core/transports/ping_delay_options.d.ts +0 -6
- package/types/src/core/transports/transport.d.ts +0 -8
- package/types/src/core/transports/transport_connection.d.ts +0 -35
- package/types/src/core/transports/transport_connection_options.d.ts +0 -6
- package/types/src/core/transports/transport_hooks.d.ts +0 -13
- package/types/src/core/transports/transport_manager.d.ts +0 -14
- package/types/src/core/transports/transports_table.d.ts +0 -10
- package/types/src/core/transports/url_scheme.d.ts +0 -11
- package/types/src/core/transports/url_schemes.d.ts +0 -4
- package/types/src/core/user.d.ts +0 -21
- package/types/src/core/util.d.ts +0 -8
- package/types/src/core/utils/collections.d.ts +0 -18
- package/types/src/core/utils/factory.d.ts +0 -29
- package/types/src/core/utils/flat_promise.d.ts +0 -6
- package/types/src/core/utils/timers/abstract_timer.d.ts +0 -10
- package/types/src/core/utils/timers/index.d.ts +0 -9
- package/types/src/core/utils/timers/scheduling.d.ts +0 -8
- package/types/src/core/utils/timers/timed_callback.d.ts +0 -4
- package/types/src/core/utils/url_store.d.ts +0 -4
- package/types/src/core/watchlist.d.ts +0 -8
- package/types/src/runtimes/interface.d.ts +0 -43
- package/types/src/runtimes/isomorphic/auth/xhr_auth.d.ts +0 -3
- package/types/src/runtimes/isomorphic/default_strategy.d.ts +0 -5
- package/types/src/runtimes/isomorphic/http/http.d.ts +0 -3
- package/types/src/runtimes/isomorphic/http/http_xhr_request.d.ts +0 -3
- package/types/src/runtimes/isomorphic/runtime.d.ts +0 -2
- package/types/src/runtimes/isomorphic/timeline/xhr_timeline.d.ts +0 -6
- package/types/src/runtimes/isomorphic/transports/transport_connection_initializer.d.ts +0 -1
- package/types/src/runtimes/isomorphic/transports/transports.d.ts +0 -5
- package/types/src/runtimes/node/net_info.d.ts +0 -6
- package/types/src/runtimes/node/runtime.d.ts +0 -3
- package/types/src/runtimes/react-native/net_info.d.ts +0 -8
- package/types/src/runtimes/react-native/runtime.d.ts +0 -3
- package/types/src/runtimes/web/auth/jsonp_auth.d.ts +0 -3
- package/types/src/runtimes/web/browser.d.ts +0 -19
- package/types/src/runtimes/web/default_strategy.d.ts +0 -5
- package/types/src/runtimes/web/dom/dependencies.d.ts +0 -4
- package/types/src/runtimes/web/dom/dependency_loader.d.ts +0 -10
- package/types/src/runtimes/web/dom/jsonp_request.d.ts +0 -10
- package/types/src/runtimes/web/dom/script_receiver.d.ts +0 -7
- package/types/src/runtimes/web/dom/script_receiver_factory.d.ts +0 -10
- package/types/src/runtimes/web/dom/script_request.d.ts +0 -9
- package/types/src/runtimes/web/http/http.d.ts +0 -2
- package/types/src/runtimes/web/http/http_xdomain_request.d.ts +0 -3
- package/types/src/runtimes/web/net_info.d.ts +0 -7
- package/types/src/runtimes/web/runtime.d.ts +0 -3
- package/types/src/runtimes/web/timeline/jsonp_timeline.d.ts +0 -6
- package/types/src/runtimes/web/transports/transport_connection_initializer.d.ts +0 -1
- package/types/src/runtimes/web/transports/transports.d.ts +0 -2
- package/types/src/runtimes/worker/auth/fetch_auth.d.ts +0 -3
- package/types/src/runtimes/worker/net_info.d.ts +0 -6
- package/types/src/runtimes/worker/runtime.d.ts +0 -3
- package/types/src/runtimes/worker/timeline/fetch_timeline.d.ts +0 -6
- package/webpack/config.node.js +0 -26
- package/webpack/config.react-native.js +0 -35
- package/webpack/config.shared.js +0 -50
- package/webpack/config.web.js +0 -36
- package/webpack/config.worker.js +0 -42
- package/webpack/dev.server.js +0 -17
- package/webpack/hosting_config.js +0 -6
- package/with-encryption/index.d.ts +0 -29
- package/with-encryption/index.js +0 -4
- package/worker/index.d.ts +0 -29
- package/worker/index.js +0 -1
- package/worker/with-encryption/index.d.ts +0 -29
- package/worker/with-encryption/index.js +0 -1
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ***** BEGIN LICENSE BLOCK *****
|
|
3
|
-
* Copyright (c) 2011-2012 VMware, Inc.
|
|
4
|
-
*
|
|
5
|
-
* For the license see COPYING.
|
|
6
|
-
* ***** END LICENSE BLOCK *****
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// The simplest and most robust transport, using the well-know cross
|
|
10
|
-
// domain hack - JSONP. This transport is quite inefficient - one
|
|
11
|
-
// mssage could use up to one http request. But at least it works almost
|
|
12
|
-
// everywhere.
|
|
13
|
-
// Known limitations:
|
|
14
|
-
// o you will get a spinning cursor
|
|
15
|
-
// o for Konqueror a dumb timer is needed to detect errors
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var JsonPTransport = SockJS['jsonp-polling'] = function(ri, trans_url) {
|
|
19
|
-
utils.polluteGlobalNamespace();
|
|
20
|
-
var that = this;
|
|
21
|
-
that.ri = ri;
|
|
22
|
-
that.trans_url = trans_url;
|
|
23
|
-
that.send_constructor(jsonPGenericSender);
|
|
24
|
-
that._schedule_recv();
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// Inheritnace
|
|
28
|
-
JsonPTransport.prototype = new BufferedSender();
|
|
29
|
-
|
|
30
|
-
JsonPTransport.prototype._schedule_recv = function() {
|
|
31
|
-
var that = this;
|
|
32
|
-
var callback = function(data) {
|
|
33
|
-
that._recv_stop = null;
|
|
34
|
-
if (data) {
|
|
35
|
-
// no data - heartbeat;
|
|
36
|
-
if (!that._is_closing) {
|
|
37
|
-
that.ri._didMessage(data);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// The message can be a close message, and change is_closing state.
|
|
41
|
-
if (!that._is_closing) {
|
|
42
|
-
that._schedule_recv();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
that._recv_stop = jsonPReceiverWrapper(that.trans_url + '/jsonp',
|
|
46
|
-
jsonPGenericReceiver, callback);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
JsonPTransport.enabled = function() {
|
|
50
|
-
return true;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
JsonPTransport.need_body = true;
|
|
54
|
-
JsonPTransport.polling = true;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
JsonPTransport.prototype.doCleanup = function() {
|
|
58
|
-
var that = this;
|
|
59
|
-
that._is_closing = true;
|
|
60
|
-
if (that._recv_stop) {
|
|
61
|
-
that._recv_stop();
|
|
62
|
-
}
|
|
63
|
-
that.ri = that._recv_stop = null;
|
|
64
|
-
that.send_destructor();
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// Abstract away code that handles global namespace pollution.
|
|
69
|
-
var jsonPReceiverWrapper = function(url, constructReceiver, user_callback) {
|
|
70
|
-
var id = 'a' + utils.random_string(6);
|
|
71
|
-
var url_id = url + '?c=' + escape(WPrefix + '.' + id);
|
|
72
|
-
|
|
73
|
-
// Unfortunately it is not possible to abort loading of the
|
|
74
|
-
// script. We need to keep track of frake close frames.
|
|
75
|
-
var aborting = 0;
|
|
76
|
-
|
|
77
|
-
// Callback will be called exactly once.
|
|
78
|
-
var callback = function(frame) {
|
|
79
|
-
switch(aborting) {
|
|
80
|
-
case 0:
|
|
81
|
-
// Normal behaviour - delete hook _and_ emit message.
|
|
82
|
-
delete _window[WPrefix][id];
|
|
83
|
-
user_callback(frame);
|
|
84
|
-
break;
|
|
85
|
-
case 1:
|
|
86
|
-
// Fake close frame - emit but don't delete hook.
|
|
87
|
-
user_callback(frame);
|
|
88
|
-
aborting = 2;
|
|
89
|
-
break;
|
|
90
|
-
case 2:
|
|
91
|
-
// Got frame after connection was closed, delete hook, don't emit.
|
|
92
|
-
delete _window[WPrefix][id];
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
var close_script = constructReceiver(url_id, callback);
|
|
98
|
-
_window[WPrefix][id] = close_script;
|
|
99
|
-
var stop = function() {
|
|
100
|
-
if (_window[WPrefix][id]) {
|
|
101
|
-
aborting = 1;
|
|
102
|
-
_window[WPrefix][id](utils.closeFrame(1000, "JSONP user aborted read"));
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
return stop;
|
|
106
|
-
};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ***** BEGIN LICENSE BLOCK *****
|
|
3
|
-
* Copyright (c) 2011-2012 VMware, Inc.
|
|
4
|
-
*
|
|
5
|
-
* For the license see COPYING.
|
|
6
|
-
* ***** END LICENSE BLOCK *****
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// Parts derived from Socket.io:
|
|
10
|
-
// https://github.com/LearnBoost/socket.io/blob/0.6.17/lib/socket.io/transports/jsonp-polling.js
|
|
11
|
-
// and jQuery-JSONP:
|
|
12
|
-
// https://code.google.com/p/jquery-jsonp/source/browse/trunk/core/jquery.jsonp.js
|
|
13
|
-
var jsonPGenericReceiver = function(url, callback) {
|
|
14
|
-
var tref;
|
|
15
|
-
var script = _document.createElement('script');
|
|
16
|
-
var script2; // Opera synchronous load trick.
|
|
17
|
-
var close_script = function(frame) {
|
|
18
|
-
if (script2) {
|
|
19
|
-
script2.parentNode.removeChild(script2);
|
|
20
|
-
script2 = null;
|
|
21
|
-
}
|
|
22
|
-
if (script) {
|
|
23
|
-
clearTimeout(tref);
|
|
24
|
-
// Unfortunately, you can't really abort script loading of
|
|
25
|
-
// the script.
|
|
26
|
-
script.parentNode.removeChild(script);
|
|
27
|
-
script.onreadystatechange = script.onerror =
|
|
28
|
-
script.onload = script.onclick = null;
|
|
29
|
-
script = null;
|
|
30
|
-
callback(frame);
|
|
31
|
-
callback = null;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// IE9 fires 'error' event after orsc or before, in random order.
|
|
36
|
-
var loaded_okay = false;
|
|
37
|
-
var error_timer = null;
|
|
38
|
-
|
|
39
|
-
script.id = 'a' + utils.random_string(8);
|
|
40
|
-
script.src = url;
|
|
41
|
-
script.type = 'text/javascript';
|
|
42
|
-
script.charset = 'UTF-8';
|
|
43
|
-
script.onerror = function(e) {
|
|
44
|
-
if (!error_timer) {
|
|
45
|
-
// Delay firing close_script.
|
|
46
|
-
error_timer = setTimeout(function() {
|
|
47
|
-
if (!loaded_okay) {
|
|
48
|
-
close_script(utils.closeFrame(
|
|
49
|
-
1006,
|
|
50
|
-
"JSONP script loaded abnormally (onerror)"));
|
|
51
|
-
}
|
|
52
|
-
}, 1000);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
script.onload = function(e) {
|
|
56
|
-
close_script(utils.closeFrame(1006, "JSONP script loaded abnormally (onload)"));
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
script.onreadystatechange = function(e) {
|
|
60
|
-
if (/loaded|closed/.test(script.readyState)) {
|
|
61
|
-
if (script && script.htmlFor && script.onclick) {
|
|
62
|
-
loaded_okay = true;
|
|
63
|
-
try {
|
|
64
|
-
// In IE, actually execute the script.
|
|
65
|
-
script.onclick();
|
|
66
|
-
} catch (x) {}
|
|
67
|
-
}
|
|
68
|
-
if (script) {
|
|
69
|
-
close_script(utils.closeFrame(1006, "JSONP script loaded abnormally (onreadystatechange)"));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
// IE: event/htmlFor/onclick trick.
|
|
74
|
-
// One can't rely on proper order for onreadystatechange. In order to
|
|
75
|
-
// make sure, set a 'htmlFor' and 'event' properties, so that
|
|
76
|
-
// script code will be installed as 'onclick' handler for the
|
|
77
|
-
// script object. Later, onreadystatechange, manually execute this
|
|
78
|
-
// code. FF and Chrome doesn't work with 'event' and 'htmlFor'
|
|
79
|
-
// set. For reference see:
|
|
80
|
-
// http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html
|
|
81
|
-
// Also, read on that about script ordering:
|
|
82
|
-
// http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
|
|
83
|
-
if (typeof script.async === 'undefined' && _document.attachEvent) {
|
|
84
|
-
// According to mozilla docs, in recent browsers script.async defaults
|
|
85
|
-
// to 'true', so we may use it to detect a good browser:
|
|
86
|
-
// https://developer.mozilla.org/en/HTML/Element/script
|
|
87
|
-
if (!/opera/i.test(navigator.userAgent)) {
|
|
88
|
-
// Naively assume we're in IE
|
|
89
|
-
try {
|
|
90
|
-
script.htmlFor = script.id;
|
|
91
|
-
script.event = "onclick";
|
|
92
|
-
} catch (x) {}
|
|
93
|
-
script.async = true;
|
|
94
|
-
} else {
|
|
95
|
-
// Opera, second sync script hack
|
|
96
|
-
script2 = _document.createElement('script');
|
|
97
|
-
script2.text = "try{var a = document.getElementById('"+script.id+"'); if(a)a.onerror();}catch(x){};";
|
|
98
|
-
script.async = script2.async = false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (typeof script.async !== 'undefined') {
|
|
102
|
-
script.async = true;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Fallback mostly for Konqueror - stupid timer, 35 seconds shall be plenty.
|
|
106
|
-
tref = setTimeout(function() {
|
|
107
|
-
close_script(utils.closeFrame(1006, "JSONP script loaded abnormally (timeout)"));
|
|
108
|
-
}, 35000);
|
|
109
|
-
|
|
110
|
-
var head = _document.getElementsByTagName('head')[0];
|
|
111
|
-
head.insertBefore(script, head.firstChild);
|
|
112
|
-
if (script2) {
|
|
113
|
-
head.insertBefore(script2, head.firstChild);
|
|
114
|
-
}
|
|
115
|
-
return close_script;
|
|
116
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ***** BEGIN LICENSE BLOCK *****
|
|
3
|
-
* Copyright (c) 2011-2012 VMware, Inc.
|
|
4
|
-
*
|
|
5
|
-
* For the license see COPYING.
|
|
6
|
-
* ***** END LICENSE BLOCK *****
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
var Polling = function(ri, Receiver, recv_url, AjaxObject) {
|
|
10
|
-
var that = this;
|
|
11
|
-
that.ri = ri;
|
|
12
|
-
that.Receiver = Receiver;
|
|
13
|
-
that.recv_url = recv_url;
|
|
14
|
-
that.AjaxObject = AjaxObject;
|
|
15
|
-
that._scheduleRecv();
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
Polling.prototype._scheduleRecv = function() {
|
|
19
|
-
var that = this;
|
|
20
|
-
var poll = that.poll = new that.Receiver(that.recv_url, that.AjaxObject);
|
|
21
|
-
var msg_counter = 0;
|
|
22
|
-
poll.onmessage = function(e) {
|
|
23
|
-
msg_counter += 1;
|
|
24
|
-
that.ri._didMessage(e.data);
|
|
25
|
-
};
|
|
26
|
-
poll.onclose = function(e) {
|
|
27
|
-
that.poll = poll = poll.onmessage = poll.onclose = null;
|
|
28
|
-
if (!that.poll_is_closing) {
|
|
29
|
-
if (e.reason === 'permanent') {
|
|
30
|
-
that.ri._didClose(1006, 'Polling error (' + e.reason + ')');
|
|
31
|
-
} else {
|
|
32
|
-
that._scheduleRecv();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
Polling.prototype.abort = function() {
|
|
39
|
-
var that = this;
|
|
40
|
-
that.poll_is_closing = true;
|
|
41
|
-
if (that.poll) {
|
|
42
|
-
that.poll.abort();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ***** BEGIN LICENSE BLOCK *****
|
|
3
|
-
* Copyright (c) 2011-2012 VMware, Inc.
|
|
4
|
-
*
|
|
5
|
-
* For the license see COPYING.
|
|
6
|
-
* ***** END LICENSE BLOCK *****
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
var EventSourceReceiver = function(url) {
|
|
10
|
-
var that = this;
|
|
11
|
-
var es = new EventSource(url);
|
|
12
|
-
es.onmessage = function(e) {
|
|
13
|
-
that.dispatchEvent(new SimpleEvent('message',
|
|
14
|
-
{'data': unescape(e.data)}));
|
|
15
|
-
};
|
|
16
|
-
that.es_close = es.onerror = function(e, abort_reason) {
|
|
17
|
-
// ES on reconnection has readyState = 0 or 1.
|
|
18
|
-
// on network error it's CLOSED = 2
|
|
19
|
-
var reason = abort_reason ? 'user' :
|
|
20
|
-
(es.readyState !== 2 ? 'network' : 'permanent');
|
|
21
|
-
that.es_close = es.onmessage = es.onerror = null;
|
|
22
|
-
// EventSource reconnects automatically.
|
|
23
|
-
es.close();
|
|
24
|
-
es = null;
|
|
25
|
-
// Safari and chrome < 15 crash if we close window before
|
|
26
|
-
// waiting for ES cleanup. See:
|
|
27
|
-
// https://code.google.com/p/chromium/issues/detail?id=89155
|
|
28
|
-
utils.delay(200, function() {
|
|
29
|
-
that.dispatchEvent(new SimpleEvent('close', {reason: reason}));
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
EventSourceReceiver.prototype = new REventTarget();
|
|
35
|
-
|
|
36
|
-
EventSourceReceiver.prototype.abort = function() {
|
|
37
|
-
var that = this;
|
|
38
|
-
if (that.es_close) {
|
|
39
|
-
that.es_close({}, true);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ***** BEGIN LICENSE BLOCK *****
|
|
3
|
-
* Copyright (c) 2011-2012 VMware, Inc.
|
|
4
|
-
*
|
|
5
|
-
* For the license see COPYING.
|
|
6
|
-
* ***** END LICENSE BLOCK *****
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
var _is_ie_htmlfile_capable;
|
|
10
|
-
var isIeHtmlfileCapable = function() {
|
|
11
|
-
if (_is_ie_htmlfile_capable === undefined) {
|
|
12
|
-
if ('ActiveXObject' in _window) {
|
|
13
|
-
try {
|
|
14
|
-
_is_ie_htmlfile_capable = !!new ActiveXObject('htmlfile');
|
|
15
|
-
} catch (x) {}
|
|
16
|
-
} else {
|
|
17
|
-
_is_ie_htmlfile_capable = false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return _is_ie_htmlfile_capable;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var HtmlfileReceiver = function(url) {
|
|
25
|
-
var that = this;
|
|
26
|
-
utils.polluteGlobalNamespace();
|
|
27
|
-
|
|
28
|
-
that.id = 'a' + utils.random_string(6, 26);
|
|
29
|
-
url += ((url.indexOf('?') === -1) ? '?' : '&') +
|
|
30
|
-
'c=' + escape(WPrefix + '.' + that.id);
|
|
31
|
-
|
|
32
|
-
var constructor = isIeHtmlfileCapable() ?
|
|
33
|
-
utils.createHtmlfile : utils.createIframe;
|
|
34
|
-
|
|
35
|
-
var iframeObj;
|
|
36
|
-
_window[WPrefix][that.id] = {
|
|
37
|
-
start: function () {
|
|
38
|
-
iframeObj.loaded();
|
|
39
|
-
},
|
|
40
|
-
message: function (data) {
|
|
41
|
-
that.dispatchEvent(new SimpleEvent('message', {'data': data}));
|
|
42
|
-
},
|
|
43
|
-
stop: function () {
|
|
44
|
-
that.iframe_close({}, 'network');
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
that.iframe_close = function(e, abort_reason) {
|
|
48
|
-
iframeObj.cleanup();
|
|
49
|
-
that.iframe_close = iframeObj = null;
|
|
50
|
-
delete _window[WPrefix][that.id];
|
|
51
|
-
that.dispatchEvent(new SimpleEvent('close', {reason: abort_reason}));
|
|
52
|
-
};
|
|
53
|
-
iframeObj = constructor(url, function(e) {
|
|
54
|
-
that.iframe_close({}, 'permanent');
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
HtmlfileReceiver.prototype = new REventTarget();
|
|
59
|
-
|
|
60
|
-
HtmlfileReceiver.prototype.abort = function() {
|
|
61
|
-
var that = this;
|
|
62
|
-
if (that.iframe_close) {
|
|
63
|
-
that.iframe_close({}, 'user');
|
|
64
|
-
}
|
|
65
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ***** BEGIN LICENSE BLOCK *****
|
|
3
|
-
* Copyright (c) 2011-2012 VMware, Inc.
|
|
4
|
-
*
|
|
5
|
-
* For the license see COPYING.
|
|
6
|
-
* ***** END LICENSE BLOCK *****
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
var XhrReceiver = function(url, AjaxObject) {
|
|
10
|
-
var that = this;
|
|
11
|
-
var buf_pos = 0;
|
|
12
|
-
|
|
13
|
-
that.xo = new AjaxObject('POST', url, null);
|
|
14
|
-
that.xo.onchunk = function(status, text) {
|
|
15
|
-
if (status !== 200) return;
|
|
16
|
-
while (1) {
|
|
17
|
-
var buf = text.slice(buf_pos);
|
|
18
|
-
var p = buf.indexOf('\n');
|
|
19
|
-
if (p === -1) break;
|
|
20
|
-
buf_pos += p+1;
|
|
21
|
-
var msg = buf.slice(0, p);
|
|
22
|
-
that.dispatchEvent(new SimpleEvent('message', {data: msg}));
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
that.xo.onfinish = function(status, text) {
|
|
26
|
-
that.xo.onchunk(status, text);
|
|
27
|
-
that.xo = null;
|
|
28
|
-
var reason = status === 200 ? 'network' : 'permanent';
|
|
29
|
-
that.dispatchEvent(new SimpleEvent('close', {reason: reason}));
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
XhrReceiver.prototype = new REventTarget();
|
|
34
|
-
|
|
35
|
-
XhrReceiver.prototype.abort = function() {
|
|
36
|
-
var that = this;
|
|
37
|
-
if (that.xo) {
|
|
38
|
-
that.xo.close();
|
|
39
|
-
that.dispatchEvent(new SimpleEvent('close', {reason: 'user'}));
|
|
40
|
-
that.xo = null;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ***** BEGIN LICENSE BLOCK *****
|
|
3
|
-
* Copyright (c) 2011-2012 VMware, Inc.
|
|
4
|
-
*
|
|
5
|
-
* For the license see COPYING.
|
|
6
|
-
* ***** END LICENSE BLOCK *****
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
var BufferedSender = function() {};
|
|
10
|
-
BufferedSender.prototype.send_constructor = function(sender) {
|
|
11
|
-
var that = this;
|
|
12
|
-
that.send_buffer = [];
|
|
13
|
-
that.sender = sender;
|
|
14
|
-
that.init_window_size = that.ri._options.init_window_size;
|
|
15
|
-
that.window_size = that.init_window_size;
|
|
16
|
-
that.max_window_time = that.ri._options.max_window_time;
|
|
17
|
-
};
|
|
18
|
-
BufferedSender.prototype.doSend = function(message) {
|
|
19
|
-
var that = this;
|
|
20
|
-
if (message.length > 0) {
|
|
21
|
-
that.send_buffer.push(message);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (that.send_stop && message.length == 0) {
|
|
25
|
-
that.ri._debug('Attempting to send a heartbeat, but sending previous messages is still in progress.');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!that.send_stop) {
|
|
29
|
-
that.send_schedule();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
BufferedSender.prototype.adjustWindow = function(td, full_window) {
|
|
35
|
-
var that = this;
|
|
36
|
-
if (td > that.max_window_time) {
|
|
37
|
-
// Over time, reduce window
|
|
38
|
-
that.window_size = Math.max(that.window_size / 2,
|
|
39
|
-
that.init_window_size);
|
|
40
|
-
return true;
|
|
41
|
-
} else {
|
|
42
|
-
if (full_window) {
|
|
43
|
-
if (td*2 < that.max_window_time) {
|
|
44
|
-
// A lot time left
|
|
45
|
-
that.window_size *= 2;
|
|
46
|
-
} else {
|
|
47
|
-
// Not so much time left...
|
|
48
|
-
that.window_size *= 1.1;
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// For polling transports in a situation when in the message callback,
|
|
57
|
-
// new message is being send. If the sending connection was started
|
|
58
|
-
// before receiving one, it is possible to saturate the network and
|
|
59
|
-
// timeout due to the lack of receiving socket. To avoid that we delay
|
|
60
|
-
// sending messages by some small time, in order to let receiving
|
|
61
|
-
// connection be started beforehand. This is only a halfmeasure and
|
|
62
|
-
// does not fix the big problem, but it does make the tests go more
|
|
63
|
-
// stable on slow networks.
|
|
64
|
-
BufferedSender.prototype.send_schedule_wait = function() {
|
|
65
|
-
var that = this;
|
|
66
|
-
var tref;
|
|
67
|
-
that.send_stop = function() {
|
|
68
|
-
that.send_stop = null;
|
|
69
|
-
clearTimeout(tref);
|
|
70
|
-
};
|
|
71
|
-
tref = utils.delay(25, function() {
|
|
72
|
-
that.send_stop = null;
|
|
73
|
-
if (that.send_buffer.length > 0) {
|
|
74
|
-
that.send_schedule();
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
BufferedSender.prototype.send_schedule = function() {
|
|
80
|
-
var that = this;
|
|
81
|
-
var t0 = +new Date();
|
|
82
|
-
var i, serialized = 2, full_window = false;
|
|
83
|
-
for (i=0; i < that.send_buffer.length; i++) {
|
|
84
|
-
serialized += that.send_buffer[i].length + 1;
|
|
85
|
-
if (serialized > that.window_size) {
|
|
86
|
-
full_window = true;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// Splice removes messages from the array.
|
|
91
|
-
var messages = that.send_buffer.splice(0, i);
|
|
92
|
-
|
|
93
|
-
var payload = '[' + messages.join(',') + ']';
|
|
94
|
-
that.send_stop = that.sender(that.trans_url, payload, function(success, abort_reason) {
|
|
95
|
-
that.send_stop = null;
|
|
96
|
-
if (success === false) {
|
|
97
|
-
that.ri._didClose(1006, 'Sending error ' + abort_reason);
|
|
98
|
-
} else {
|
|
99
|
-
var td = (+new Date()) - t0;
|
|
100
|
-
if (that.adjustWindow(td, full_window)) {
|
|
101
|
-
that.ri._debug('window_size adjusted: ' + that.window_size);
|
|
102
|
-
}
|
|
103
|
-
that.send_schedule_wait();
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
BufferedSender.prototype.send_destructor = function() {
|
|
109
|
-
var that = this;
|
|
110
|
-
if (that.send_stop) {
|
|
111
|
-
that.send_stop();
|
|
112
|
-
}
|
|
113
|
-
that.send_stop = null;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
var jsonPGenericSender = function(url, payload, callback) {
|
|
117
|
-
var that = this;
|
|
118
|
-
var js = new JsonpSender(url, payload, that);
|
|
119
|
-
js.onfinish = function(){
|
|
120
|
-
callback(true);
|
|
121
|
-
};
|
|
122
|
-
return function(){
|
|
123
|
-
js.close();
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
var createAjaxSender = function(AjaxObject) {
|
|
128
|
-
return function(url, payload, callback) {
|
|
129
|
-
var xo = new AjaxObject('POST', url + '/xhr_send', payload);
|
|
130
|
-
xo.onfinish = function(status, text) {
|
|
131
|
-
callback(status === 200 || status === 204,
|
|
132
|
-
'http status ' + status);
|
|
133
|
-
};
|
|
134
|
-
return function(abort_reason) {
|
|
135
|
-
xo.close();
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ***** BEGIN LICENSE BLOCK *****
|
|
3
|
-
* Copyright (c) 2011-2012 VMware, Inc.
|
|
4
|
-
*
|
|
5
|
-
* For the license see COPYING.
|
|
6
|
-
* ***** END LICENSE BLOCK *****
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
var AjaxBasedTransport = function() {};
|
|
10
|
-
AjaxBasedTransport.prototype = new BufferedSender();
|
|
11
|
-
|
|
12
|
-
AjaxBasedTransport.prototype.run = function(ri, trans_url,
|
|
13
|
-
url_suffix, Receiver, AjaxObject) {
|
|
14
|
-
var that = this;
|
|
15
|
-
that.ri = ri;
|
|
16
|
-
that.trans_url = trans_url;
|
|
17
|
-
that.send_constructor(createAjaxSender(AjaxObject));
|
|
18
|
-
that.poll = new Polling(ri, Receiver,
|
|
19
|
-
trans_url + url_suffix, AjaxObject);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
AjaxBasedTransport.prototype.doCleanup = function() {
|
|
23
|
-
var that = this;
|
|
24
|
-
if (that.poll) {
|
|
25
|
-
that.poll.abort();
|
|
26
|
-
that.poll = null;
|
|
27
|
-
}
|
|
28
|
-
that.send_destructor();
|
|
29
|
-
};
|