Cordova plugin that provides WebSocket (RFC6455) support for Android versions prior to 4.4 (KitKat) and Crosswalk environments where native WebSocket may be absent. Stable version 0.12.2, last updated in 2016. Based on Jetty 8, it implements both text and binary messages (binary requires API >= 14). Unlike alternative WebSocket plugins for Cordova, this one is specifically designed for older Android devices and is not used on Android 4.4+ by default. It requires cordova-android 3.6.0+ and a whitelist plugin for cordova-android 4.0.0+.
npm install cordova-plugin-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to use the plugin's WebSocket constructor after device ready, including event handlers and conditional check for native WebSocket.
Not required; native WebSocket is supported on those versions.
Manually add INTERNET permission to AndroidManifest.xml if needed after removal.
Upgrade to a more modern WebSocket solution or target Android 4.4+.
Supports only text messages on API 10. Check Android version at runtime.
Ensure server uses TLS (not SSL) for secure WebSocket connections.
Run 'cordova plugin add cordova-plugin-websocket' and rebuild.
Remove and reinstall the plugin: 'cordova plugin rm cordova-plugin-websocket && cordova plugin add cordova-plugin-websocket'
Add 'connect-src ws://example.com wss://example.com' to the CSP meta tag in index.html.
Ensure code runs after deviceready event. Check if plugin is installed correctly.