I installed the plugin for my cordova app using:
cordova plugin add cordova-plugin-advanced-websocket
Testing the sample code on Android device:
`var accessToken = "abcdefghiklmnopqrstuvwxyz";
var wsOptions = {
url: "wss://echo.websocket.org",
timeout: 5000,
pingInterval: 10000,
headers: {"Authorization": "Bearer " + accessToken},
acceptAllCerts: false
}
CordovaWebsocketPlugin.wsConnect(wsOptions,
function(recvEvent) {
console.log("Received callback from WebSocket: "+recvEvent["callbackMethod"]);
},
function(success) {
console.log("Connected to WebSocket with id: " + success.webSocketId);
},
function(error) {
console.log("Failed to connect to WebSocket: "+
"code: "+error["code"]+
", reason: "+error["reason"]+
", exception: "+error["exception"]);
}
);`
I get the following error:
Uncaught ReferenceError ReferenceError: CordovaWebsocketPlugin is not defined
This used to work before, I am not quite sure, when this started to appear since I didn't use this code for a few months.
Can you reproduce this error or have any help for me?
Hi,
I installed the plugin for my cordova app using:
cordova plugin add cordova-plugin-advanced-websocket
Testing the sample code on Android device: `var accessToken = "abcdefghiklmnopqrstuvwxyz"; var wsOptions = { url: "wss://echo.websocket.org", timeout: 5000, pingInterval: 10000, headers: {"Authorization": "Bearer " + accessToken}, acceptAllCerts: false }
CordovaWebsocketPlugin.wsConnect(wsOptions, function(recvEvent) { console.log("Received callback from WebSocket: "+recvEvent["callbackMethod"]); }, function(success) { console.log("Connected to WebSocket with id: " + success.webSocketId); }, function(error) { console.log("Failed to connect to WebSocket: "+ "code: "+error["code"]+ ", reason: "+error["reason"]+ ", exception: "+error["exception"]); } );`
I get the following error:
This used to work before, I am not quite sure, when this started to appear since I didn't use this code for a few months. Can you reproduce this error or have any help for me?
Thanks in advance! Torben