From 5af08f7a8d5ab5f7e6ccb69d3979c7e0f404dd71 Mon Sep 17 00:00:00 2001 From: evanweible-wf Date: Mon, 29 Jan 2018 10:23:22 -0700 Subject: [PATCH 1/2] Use hasProperty to detect sockjs.js --- example/index.html | 2 +- example/web_socket/echo/client.dart | 9 +++++++-- example/web_socket/echo/index.html | 13 +++++++++++-- lib/src/web_socket/browser/sockjs.dart | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/example/index.html b/example/index.html index ca4d1d1d..2a43fe1f 100644 --- a/example/index.html +++ b/example/index.html @@ -48,4 +48,4 @@

WebSocket

- \ No newline at end of file + diff --git a/example/web_socket/echo/client.dart b/example/web_socket/echo/client.dart index effe6024..f090c4ef 100644 --- a/example/web_socket/echo/client.dart +++ b/example/web_socket/echo/client.dart @@ -36,7 +36,9 @@ TextInputElement _prompt = querySelector('#prompt'); PreElement _logs = querySelector('#logs'); NumberInputElement _sockJSTimeout = querySelector('#sockjs-timeout'); CheckboxInputElement _sockJSWebSocket = querySelector('#sockjs-ws'); -CheckboxInputElement _sockJSXhr = querySelector('#sockjs-xhr'); +CheckboxInputElement _sockJSXhrStreaming = + querySelector('#sockjs-xhr-streaming'); +CheckboxInputElement _sockJSXhrPolling = querySelector('#sockjs-xhr-polling'); CheckboxInputElement _useSockJS = querySelector('#sockjs'); Future main() async { @@ -60,9 +62,12 @@ Future main() async { if (_sockJSWebSocket.checked) { protocols.add('websocket'); } - if (_sockJSXhr.checked) { + if (_sockJSXhrStreaming.checked) { protocols.add('xhr-streaming'); } + if (_sockJSXhrPolling.checked) { + protocols.add('xhr-polling'); + } final uri = sockjs ? _sockJSServer : _wsServer; try { diff --git a/example/web_socket/echo/index.html b/example/web_socket/echo/index.html index 520971fc..a659a672 100644 --- a/example/web_socket/echo/index.html +++ b/example/web_socket/echo/index.html @@ -43,13 +43,20 @@

Echo


-