Chromecast Receiver App Error: The WebSocket disconnected unexpectedly: undefined - google-cast

I'm trying to get a basic chromecast app setup where I can send a simple custom message from Desktop Chrome to the Chromecast receiver. The devices is whitelisted, and the app sources are sitting at the url specified during the whitelisting process. Additionally the correct API_ID is being used and the NAMESPACE is the same for the receiver and sender apps.
The receiver app loads, but just after that I get:
[ 0.230s] [goog.net.WebSocket] The WebSocket disconnected unexpectedly: undefined
This seems to be preventing me from being able to send custom messages to the Chromecast.
From the sender app I am able to locate the device, connect, and launch the receiver app. I am also able to properly disconnect with the stopActivity() call on the sender.
The setup for the receiver is:
var receiver = new cast.receiver.Receiver(APP_ID, NAMESPACE);
var channelHandler = new cast.receiver.ChannelHandler(NAMESPACE);
channelHandler.addChannelFactory(receiver.createChannelFactory(NAMESPACE));
channelHandler.addEventListener('error', function($e){
console.log('JAC - Error!');
});
channelHandler.addEventListener('open', function($e){
console.log('JAC - OnOpen!');
});
channelHandler.addEventListener('message', function($e){
console.log('JAC - Message: ' + $e.type);
});
receiver.start();
The full log from the Chromecast device is (actual appId removed):
[ 0.027s] [cast.receiver.ChannelHandler] New channel factory added: MY-APP-ID to heartbeatChannelHandler
cast_receiver.js:66
[ 0.088s] [cast.receiver.ChannelHandler] New channel factory added: receiverTest1: MY-APP-ID to receiverTest1
cast_receiver.js:66
[ 0.094s] [cast.receiver.ConnectionService] Open connection service websocket: url=ws://localhost:8008/connection
cast_receiver.js:66
[ 0.098s] [goog.net.WebSocket] Opening the WebSocket on ws://localhost:8008/connection
cast_receiver.js:66
[ 0.104s] [cast.receiver.Receiver] Receiver started.
cast_receiver.js:66
[ 0.142s] [goog.net.WebSocket] WebSocket opened on ws://localhost:8008/system/control
cast_receiver.js:66
[ 0.153s] [cast.receiver.ChannelOverWebSocket] Dispatch OPEN event to ws://localhost:8008/system/control
cast_receiver.js:66
[ 0.159s] [cast.receiver.Channel] Dispatch OPEN event to ws://localhost:8008/system/control
cast_receiver.js:66
[ 0.164s] [cast.receiver.Platform] Platform channel is open: ws://localhost:8008/system/control
cast_receiver.js:66
[ 0.208s] [goog.net.WebSocket] WebSocket opened on ws://localhost:8008/connection
cast_receiver.js:66
[ 0.212s] [cast.receiver.ConnectionService] Got event: d
cast_receiver.js:66
[ 0.222s] [goog.net.WebSocket] The WebSocket on ws://localhost:8008/connection closed.
cast_receiver.js:66
[ 0.225s] [cast.receiver.ConnectionService] Got event: a
cast_receiver.js:66
[ 0.230s] [goog.net.WebSocket] The WebSocket disconnected unexpectedly: undefined
Any help in the matter would be greatly appreciated! Thanks!

The type for NAMESPACE in the Receiver constructor needs to be a an array. I'm guessing that in your code sample it is a string. That could cause the strange problems you are seeing.

Related

Subscribing and reading from Topic: ActiveMQ & Python

I am trying to subscribe to a topic in ActiveMQ running in localhost using stompest for connecting to the broker. Please refer below code:
import os
import json
from stompest.sync import Stomp
from stompest.config import StompConfig
CONFIG = StompConfig(uri=os.environ['MQ_URL'],
login=os.environ['MQ_UID'],
passcode=os.environ['MQ_DWP'],
version="1.2")
topic = '/topic/SAMPLE.TOPIC'
msg = {'refresh': True}
client = Stomp(CONFIG)
client.connect()
client.send(topic, json.dumps(msg).encode())
client.disconnect()
client = Stomp(CONFIG)
client.connect(heartBeats=(0, 10000))
token = client.subscribe(topic, {
"ack": "client",
"id": '0'
})
frame = client.receiveFrame()
if frame and frame.body:
print(f"Frame received from MQ: {frame.info()}")
client.disconnect()
Although I see active connection it the ActiveMQ web console, no message is received in the code. The flow of control seems to pause at frame = client.receiveFrame().
I didn't find any reliable resource or documentation regarding this.
Am I doing anything wrong here?
This is the expected behavior since you're using a topic (i.e. pub/sub semantics). When you send a message to a topic it will be delivered to all existing subscribers. If no subscribers are connected then the message is discarded.
You send your message before any subscribers are connected which means the broker will discard the message. Once the subscriber connects there are no messages to receive therefore receiveFrame() will simply block waiting for a frame as the stompest documentation notes:
Keep in mind that this method will block forever if there are no frames incoming on the wire.
Try either sending a message to a queue and then receiving it or creating an asynchronous client first and then sending your message.

Onesignal node js Incorrect player_id format in include_player_ids

When I am trying to send a push notification to the list of Android devices getting below error and notification not delivered to any device.
Error: [
'Incorrect player_id format in include_player_ids (not a valid UUID): 1234567890'
]
Devices array
device [
'2e52e176-0764-47e4-944f-b211c12e9407',
'1234567890',
'e3bf4c0b-dd7e-486c-a4b9-838ea66c3233'
]
My question is
How I can handle the wrong device id (1234567890)?
Because of the wrong device id push notification not delivered to any device.

Why Botframework bot only works only on Emulator and none of the other channels?

Bot Info
Bot handle: Medibot_medibuddy
App ID: dcda60fe-72d4-4796-a728-de8fa3aef2a5
SDK Platform: Node.js
SDK Version: Latest
Active Channels: WebChat, Facebook, Skype
Deployment Environment: Azure App Service
Issue Description
Our bot (Medibot, https://medibotmb.azurewebsites.net) has suddenly stopped working on all channels including WebChat. It works perfectly on Emulator though. We've been trying to debug this issue since days and have not been successful with any solutions/suggestions online. I've tried using Log stream and debug console to catch exceptions but there aren't any.
Code Example
The code is hosted in https://github.com/nirmalrayan/medibot
Reproduction Steps
Visit medibotmb.azurewebsites.net. This should open WebChat channel's index.html document.
The page tries to load for a long time and throws HTTP status: 500, HTTP subStatus: 1001, HTTP Reason: Internal Server Errror.
Bot framework displays the error message 'There was an error sending this message to your bot: HTTP status code GatewayTimeout' for Facebook and Web Chat channels.
Expected Behavior
Render index.html page with Web Chat iframe.
After the user sends first message, the bot welcomes with a hero card.
Actual Results
Nothing happens. The page does not get rendered. No exception in thrown in log stream while testing. Even botframework 'Test' does not throw any error in Azure app service log stream.
node.js
I don't see the iframe code in the index.html of https://medibotmb.azurewebsites.net

How to send sms to mobile using spring integration smpp library in java?

I am trying to send sms to mobile with smppsessionfactorybean. I configured host, port,systemid,password,bindtype,autostartup.(with nexmo sms server configuration).
But at the time of send() method call it is throwing
"java.io.IOException: Cannot submitShortMessage while in state CLOSED".
what is the meaning of this error?
sysout:-- SessionState: CLOSED
sysout:-- SessionId: 09ca74d9
IO error occur
java.io.IOException: Cannot submitShortMessage while in state CLOSED
at org.jsmpp.session.AbstractSession.ensureTransmittable(AbstractSession.java:375)
at org.jsmpp.session.AbstractSession.ensureTransmittable(AbstractSession.java:358)
at org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:312)
at org.jsmpp.session.SMPPSession$$FastClassBySpringCGLIB$$9f8cc1d0.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:629)
at org.jsmpp.session.SMPPSession$$EnhancerBySpringCGLIB$$636b51bb.submitShortMessage()
at org.springframework.integration.smpp.core.SmesMessageSpecification.send(SmesMessageSpecification.java:420)
At the time of send, the smpp session is already closed and needs a binding again. so just before send check for the session is in the bind state, if not do connectAndBind() and send;

Pusher subscription fails silently

I am subscribing to a channel in Pusher on my local machine using the Javascript SDK, and I don't get any error.
However, when I publish an event to that channel it is not received by the subscriber.
I've looked at Pusher's debug console and saw that the message is indeed sent but the subscription never occurs, as the connection is somehow interrupted, apparently prior to the subscription request (i.e I get a disconnection message, as shown in the console screenshot below).
the code is pretty boilerplate:
var pusher = new Pusher('PUSHER_KEY');
channel = pusher.subscribe('game' + game.gameId);
channel.bind('statusChange', function(game) {
console.log("GOT PUSHER - STATUS " + game.status);
$scope.game.status = game.status;
});
Examining the channel.subscribed property shows that the subscription failed as it equals false. I am at the sandbox plan (max 20 connections) and am only using 2 connections.
What can disrupt the connection?
The channel object:
Console screenshot:
I don't know what's the issue exactly but enabling the logs on the client side might help your find it:
Pusher.log = function(message) {
if (window.console && window.console.log) {
window.console.log(message);
}
};
There's some resources on the website to debug that kind of problem too: http://pusher.com/docs/debugging

Resources