You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-25Lines changed: 28 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# WebSocket for Android [](http://badge.fury.io/gh/knowledgecode%2FWebSocket-for-Android)
2
-
WebSocket for Android is a Cordova plugin that allows WebSockets (RFC 6455) to be used on Android.
2
+
WebSocket for Android is a Cordova plugin that makes WebSocket (RFC 6455) available on Android.
3
3
This is based on [Jetty 8](https://github.com/eclipse/jetty.project/tree/jetty-8) under the terms of the Apache License v2.0.
4
4
5
5
## Requirements
6
6
- Android 2.3 or later (recommended 4.1 or later)
7
7
-`cordova-android@3.0.0` or later or compatible framework
8
-
-`cordova-plugin-whitelist` or `cordova-plugin-legacy-whitelist` if using `cordova-android@4.0.0`or later
8
+
-`cordova-plugin-whitelist` or `cordova-plugin-legacy-whitelist` if using `cordova-android@4.0.0`and later
9
9
10
10
The plugin for Cordova 2.x can be found [here](https://github.com/knowledgecode/WebSocket-for-Android/tree/2.x).
11
11
@@ -24,21 +24,21 @@ The plugin for Cordova 2.x can be found [here](https://github.com/knowledgecode/
24
24
25
25
#### Notes
26
26
- WSS protocol is only supported TLS. SSLv3 is not.
27
-
- Android 3.x (Honeycomb) are not supported (maybe work, but not tested).
28
-
- A new WebView based on Chromium supports WebSockets. Specifically Android 4.4 (KitKat) and later support them, so this plugin is **NOT** used on them by default.
29
-
-This plugin can be used [Crosswalk](https://crosswalk-project.org/) together in `cordova-android@4.0.0`. In this case also this is not used by default because it supports WebSockets.
30
-
-If include Android 5.x (Lollipop) as target, would be better to build with `cordova-android@3.7.1` or later.
27
+
- Android 3.x (Honeycomb) are not supported (might work but is not tested).
28
+
- A new WebView based on Chromium supports WebSocket. Specifically Android 4.4 (KitKat) and later support them, so this plugin is **NOT** used on them by default.
29
+
-In `cordova-android@4.0.0` and later, this plugin can be used together with [Crosswalk](https://crosswalk-project.org/). In this case also it is not used by default because Crosswalk supports WebSocket.
30
+
-To support Android 5.x (Lollipop), would be better to build with `cordova-android@3.7.1` or later.
31
31
32
32
## Installation
33
33
Use Cordova Command-Line Interface (CLI). At first, check Cordova version:
Also will need to install `cordova-plugin-whitelist` or `cordova-plugin-legacy-whitelist` if using `cordova-android@4.0.0`.
73
+
Also will need to install `cordova-plugin-whitelist` or `cordova-plugin-legacy-whitelist` if using `cordova-android@4.0.0` and later.
74
74
75
75
#### Caveats
76
76
When install this plugin, it adds `INTERNET` permission to `platforms/android/AndroidManifest.xml`. If remove this plugin, the permission is also removed at the same time even if it is required for other plugins.
@@ -103,29 +103,32 @@ document.addEventListener('deviceready', function () {
103
103
}, false);
104
104
```
105
105
#### Options
106
-
This plugin has the following options. All these parameters are optional. Of course these don't affect native WebSocket.
`origin` is a value to set the request header field. Default value is usually `file://`. This is the same value as when using built-in WebSocket.
118
119
`maxConnectTime` is time to wait for connection. A unit is millisecond.
119
-
`maxTextMessageSize` and `maxBinaryMessageSize` are receivable maximum size from a server. Default value is -1 (unlimited. depends on heap size of devices). A unit is byte.
120
-
`override` is a flag to force WebView to use this plugin even if supports WebSockets. For example, in case that want to apply them these options. However will be slower than native WebSocket.
121
-
`agent` is user-agent to set the request header field. Default value depends on devices. This is the same value as when using native WebSocket.
120
+
`maxTextMessageSize` and `maxBinaryMessageSize` are receivable maximum size from the server. Default value is -1 (unlimited. depends on devices heap size). A unit is byte.
121
+
`override` is a flag to force WebView to use this plugin even if it supports WebSocket. However in most cases it will be slower than built-in WebSocket.
122
+
`agent` is user-agent to set the request header field. Default value depends on devices. This is the same value as when using built-in WebSocket.
123
+
`perMessageDeflate` is a flag whether to use permessage-deflate extension or not. Default value is false for now because it is still experimental. If you would like to try it, set to true. However It is necessary that the server supports permessage-deflate.
122
124
123
125
If change these parameters, need to do before creating a instance:
0 commit comments