iOS webview refusing connection but Android working fine - nativescript

I'm loading a WebView inside a modal but when I click on a link within the WebView nothing happens. It's working as expected on Android but not in iOS, neither on a physical device nor in the simulator.
When I use utilsModule.openUrl(this.myUrl); instead of a WebView iOS follows all links and clicks just fine but I'd prefer it be in a WebView.
if (event.item.insight_ctaurl) {
this.url =
"https://myurl.com=" +
decodeURIComponent(event.item.insight_ctaurl);
let Detail = {
template: `
<Page>
<ActionBar title="Detail"/>
<StackLayout>
<WebView
height="95%"
id="myWebView"
loaded="viewLoaded"
src="${this.url}"/>
<ios>
<Button class="returnButtonios" #tap="$modal.close" text="Return to App" />
</ios>
</StackLayout>
</Page>
`
};
this.$showModal(Detail, {
fullscreen: true
});
}
else {
console.log("eventid", event.item.id);
event.item.id;
}
}
When I click a link within the WebView nothing happens for about 5 seconds and then the console outputs this:
UIProcess is releasing a background assertion because the WebContent process is no longer holding locked files
removing all entries config 0x283c969a0
Task <38AEAEA1-9046-4CAA-92A1-48E2E885B107>.<1> resuming, QOS(0x19)
TIC TCP Conn Start [20:0x28089ca80]
[C20 127.0.0.1:8098 tcp, url hash: 169e4814] start
nw_connection_report_state_with_handler_locked [C20] reporting state preparing
Task <38AEAEA1-9046-4CAA-92A1-48E2E885B107>.<1> setting up Connection 20
nw_socket_handle_socket_event [C20:2] Socket received CONNRESET event
nw_socket_handle_socket_event [C20:2] Socket received DISCONNECTED event
nw_socket_handle_socket_event [C20:2] Socket SO_ERROR [61: Connection refused]
nw_endpoint_flow_protocol_disconnected [C20 127.0.0.1:8098 in_progress socket-flow (satisfied)] Output protocol disconnected
nw_connection_report_state_with_handler_locked [C20] reporting state failed error Connection refused
TIC TCP Conn Event [20:0x28089ca80]: 3
TIC TCP Conn Failed [20:0x28089ca80]: 1:61 Err(61)
TIC TCP Conn Cancel [20:0x28089ca80]
[C20 127.0.0.1:8098 tcp, url hash: 169e4814] cancel
[C20 127.0.0.1:8098 tcp, url hash: 169e4814] cancelled
0.000s [C20 <private> 127.0.0.1:60611<->127.0.0.1:8098 socket-flow] path:start
0.000s [C20 <private> 127.0.0.1:60611<->127.0.0.1:8098 socket-flow] path:satisfied
0.001s [C20 <private> 127.0.0.1:60611<->127.0.0.1:8098 socket-flow] flow:start_connect
0.008s [C20 <private> 127.0.0.1:60611<->127.0.0.1:8098 socket-flow] flow:failed_connect Connection refused
0.011s [C20] path:cancel
nw_connection_report_state_with_handler_locked [C20] reporting state cancelled error Connection refused
TIC TCP Conn Destroyed [20:0x28089ca80]
Task <38AEAEA1-9046-4CAA-92A1-48E2E885B107>.<1> HTTP load failed (error code: -1004 [1:61])
Task <38AEAEA1-9046-4CAA-92A1-48E2E885B107>.<1> finished with error - code: -1004
removing all entries config 0x283c85320
TIC TCP Conn Cancel [17:0x2808a5740]
[C17 Hostname#6ecfd496:443 tcp, url hash: 8e40750a, tls] cancel
[C17 Hostname#6ecfd496:443 tcp, url hash: 8e40750a, tls] cancelled
[C17.1 <private> 192.168.1.53:53708<->IPv4#73fdf0fc:443]
Connected Path: satisfied (Path is satisfied), interface: en0, ipv4, dns
Duration: 37.269s, DNS #0.000s took 0.048s, TCP #0.050s took 0.054s, TLS took 0.142s
bytes in/out: 16324/949, packets in/out: 14/3, rtt: 0.860s, retransmitted packets: 0, out-of-order packets: 0
0.000s [C17 <private> Hostname#6ecfd496:443 resolver] path:start
0.000s [C17 <private> Hostname#6ecfd496:443 resolver] path:satisfied
0.000s [C17 <private> Hostname#6ecfd496:443 resolver] resolver:start_dns
0.048s [C17 <private> Hostname#6ecfd496:443 resolver] resolver:receive_dns
0.048s [C17.1 <private> 192.168.1.53:53708<->IPv4#73fdf0fc:443 channel-flow] path:start
0.049s [C17.1 <private> 192.168.1.53:53708<->IPv4#73fdf0fc:443 channel-flow] path:satisfied
0.049s [C17.1 <private> 192.168.1.53:53708<->IPv4#73fdf0fc:443 channel-flow] flow:start_nexus
0.049s [C17.1 <private> 192.168.1.53:53708<->IPv4#73fdf0fc:443 channel-flow] flow:receive_nexus
0.050s [C17.1 <private> 192.168.1.53:53708<->IPv4#73fdf0fc:443 channel-flow] flow:start_connect
0.104s [C17.1 <private> 192.168.1.53:53708<->IPv4#73fdf0fc:443 channel-flow] flow:finish_transport
0.104s [C17 <private> Hostname#6ecfd496:443 resolver] flow:finish_transport
0.246s [C17.1 <private> 192.168.1.53:53708<->IPv4#73fdf0fc:443 channel-flow] flow:finish_connect
0.246s [C17 <private> Hostname#6ecfd496:443 resolver] flow:finish_connect
0.246s [C17.1 <private> 192.168.1.53:53708<->IPv4#73fdf0fc:443 channel-flow] flow:changed_viability
0.246s [C17 <private> Hostname#6ecfd496:443 resolver] flow:changed_viability
3.265s [C17] client:data_stall
37.267s [C17] path:cancel
nw_protocol_tcp_log_summary [C17.1:3]
[<private> <private>:53708<-><private>:443]
Init: 1, Conn_Time: 53.933ms, Syn's: 1, WR_T: 0/0, RD_T: 0/0, TFO: 0/0/0, ECN: 0/0/0, TS: 1
RTT_Cache: none, rtt_upd: 5, rtt: 860.125ms, rtt_var: 1616.500ms rtt_nc: 860.125ms, rtt_var_nc: 1616.500ms
nw_endpoint_flow_protocol_disconnected [C17.1 IPv4#73fdf0fc:443 cancelled channel-flow (null)] Output protocol disconnected
nw_connection_report_state_with_handler_locked [C17] reporting state cancelled
TIC TCP Conn Destroyed [17:0x2808a5740]

Related

Not receiving payloads from mosquitto via websockets

I'm using a VPS and I'm sending data from my Arduino to the server via MQTT.
Mosquitto print payloads via terminal successfully but when I try to print it in real time via a web page nothing happens.
Knowing that I've already allowed websockets in Mosquitto conf, if I run :
sudo netstat -plnt
I get :
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN
13248/mosquitto
tcp 0 0 0.0.0.0:1884 0.0.0.0:* LISTEN
20169/mosquitto
tcp6 0 0 :::1883 :::* LISTEN 13248/mosquitto
the topic I'm sending name : /pression and the code I'm using is:
<script>
var websocket="myserver.ovh.net";
var port= 1884;
var user="username";
var pass="password";
client = new Paho.MQTT.Client(websocket, port, "innovation");
// set callback handlers
client.onConnectionLost = onConnectionLost;
client.onMessageArrived = onMessageArrived;
var options = {
useSSL: false,
userName: user,
password: pass,
onSuccess:onConnect,
onFailure:doFail
}
// connect the client
client.connect(options);
// called when the client connects
function onConnect() {
// Once a connection has been made, make a subscription and send a
message.
document.getElementById("connstatus").innerHTML = "Mqtt Connected";
console.log("Mqtt Connected");
client.subscribe("/pression");
}
function doFail(e){
console.log(e);
}
// called when the client loses its connection
function onConnectionLost(responseObject) {
document.getElementById("connstatus").innerHTML = "Mqtt Not Connected";
if (responseObject.errorCode !== 0) {
console.log("onConnectionLost:"+responseObject.errorMessage);
}
}
function onMessageArrived(message) {
console.log("Pression is :");
document.getElementById("connstatus").innerHTML = message.payloadString;
console.log(message.payloadString);
}
</script>
when I run the script it says "Mqtt Connected" than nothing happened.
However if I run in the terminal :
mosquitto_sub -t '/pression'
I get the pressure values.
if I keep the web page on for some minutes I get this message :
Mqtt Connected
test.html:76 onConnectionLost:AMQJS0008I Socket closed.
config file :
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
#password_file /etc/mosquitto/passwd
#allow_anonymous false
listener 1884
protocol websockets
mosquitto log :
1557922249: Config loaded from /etc/mosquitto/mosquitto.conf.
1557922249: Opening websockets listen socket on port 1884.
1557922254: New client connected from xx.xx.11.163 as innovation (c1, k60, u'innovation').
1557922279: Socket error on client innovation, disconnecting.
1557922279: New client connected from xx.xx.11.163 as innovation (c1, k60, u'innovation').
1557922318: Socket error on client innovation, disconnecting.
1557922318: New client connected from xx.xx.11.163 as innovation (c1, k60, u'innovation').
1557922346: Socket error on client innovation, disconnecting.
1557922346: New client connected from xx.xx.11.163 as innovation (c1, k60, u'innovation').
1557922363: Socket error on client innovation, disconnecting.
1557922364: New client connected from xx.xx.11.163 as innovation (c1, k60, u'innovation').
1557922463: Socket error on client innovation, disconnecting.
OK, the problem here is most likely that you are using a fixed client id (innovation) in the HTML.
You can only ever have 1 client connected with a given client id, so the broker will disconnect the oldest one when a new client with the same id connects (e.g. when you reload the page).
Try changing the connection line to something like this:
var clientID = "innovation_" + new Date().getTime();
client = new Paho.MQTT.Client(websocket, port, clientID);

RabbitMQ: Channel shutdown: connection error

I've setup rabbitmq with spring boot. Everything seems to be working fine in my local environment. But when I deploy it to production I'm getting this error:
31-05-2019 08:26:56.430 [ajp-bio-8009-exec-2] INFO org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createBareConnection - Attempting to connect to: localhost:5672
31-05-2019 08:26:56.433 [AMQP Connection 127.0.0.1:5672] ERROR org.springframework.amqp.rabbit.connection.CachingConnectionFactory.log - Channel shutdown: connection error; protocol method: #method<connection.close>(reply-code=541, reply-text=INTERNAL_ERROR, class-id=0, method-id=0)
31-05-2019 08:26:56.434 [AMQP Connection 127.0.0.1:5672] WARN com.rabbitmq.client.impl.ForgivingExceptionHandler.log - An unexpected connection driver error occured (Exception message: Connection reset)
31-05-2019 08:26:56.452 [ajp-bio-8009-exec-2] INFO org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createBareConnection - Created new connection: connectionFactory#8139c95:2/SimpleConnection#4f0210ae [delegate=amqp://admin#127.0.0.1:5672/, localPort= 47206]
31-05-2019 08:26:56.457 [ajp-bio-8009-exec-2] ERROR com.cinch.gch.core.config.GchExceptionHandler.handleAllOtherException - ExceptionHandler
org.springframework.amqp.AmqpIOException: java.io.IOException
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:71)
at org.springframework.amqp.rabbit.connection.RabbitAccessor.convertRabbitAccessException(RabbitAccessor.java:113)
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1473)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1423)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1399)
at org.springframework.amqp.rabbit.core.RabbitAdmin.declareExchange(RabbitAdmin.java:180)
at com.cinch.gch.mailq.queue.ProducerConfiguration.<init>(ProducerConfiguration.java:41)
at com.cinch.gch.mailq.queue.MQQueue.init(MQQueue.java:39)
at com.cinch.gch.mailq.queue.MQQueue.<init>(MQQueue.java:25)
at com.cinch.gch.mailq.service.MailService.send(MailService.java:42)
at com.cinch.gch.mailq.controller.MailController.sendMails(MailController.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130)
at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66)
at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:105)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:193)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: null
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:124)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:120)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:142)
at com.rabbitmq.client.impl.ChannelN.exchangeDeclare(ChannelN.java:773)
at com.rabbitmq.client.impl.ChannelN.exchangeDeclare(ChannelN.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:1029)
at com.sun.proxy.$Proxy564.exchangeDeclare(Unknown Source)
at org.springframework.amqp.rabbit.core.RabbitAdmin.declareExchanges(RabbitAdmin.java:630)
at org.springframework.amqp.rabbit.core.RabbitAdmin.access$000(RabbitAdmin.java:72)
at org.springframework.amqp.rabbit.core.RabbitAdmin$1.doInRabbit(RabbitAdmin.java:184)
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1467)
... 52 common frames omitted
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=541, reply-text=INTERNAL_ERROR, class-id=0, method-id=0)
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:443)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:263)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:136)
... 64 common frames omitted
31-05-2019 08:26:57.434 [AMQP Connection 127.0.0.1:5672] ERROR org.springframework.amqp.rabbit.connection.CachingConnectionFactory.log - Channel shutdown: connection error; protocol method: #method<connection.close>(reply-code=320, reply-text=CONNECTION_FORCED - broker forced connection closure with reason 'shutdown', class-id=0, method-id=0)
31-05-2019 08:26:57.444 [AMQP Connection 127.0.0.1:5672] WARN com.rabbitmq.client.impl.ForgivingExceptionHandler.log - An unexpected connection driver error occured (Exception message: Connection reset)
Anyone have any idea what is about? Not posting code since it's working in local environment, and I believe it's because I'm missing something in the server side. If you think otherwise, let me know.
Edit
Error occurs when I'm trying to create queues dynamically and add consumers. It seems the queues are created in the management console. but the listeners are not added.
Edit
Rabbitmq logs
=ERROR REPORT==== 31-May-2019::09:03:17 ===
** Generic server <0.627.0> terminating
** Last message in was {'$gen_cast',
{method,
{'exchange.declare',0,<<"mailq-exchange">>,
<<"x-delayed-message">>,false,true,false,
false,false,
[{<<"x-delayed-type">>,longstr,
<<"topic">>}]},
none,noflow}}
** When Server state == {ch,running,rabbit_framing_amqp_0_9_1,1,<0.618.0>,
<0.625.0>,<0.618.0>,
<<"127.0.0.1:47239 -> 127.0.0.1:5672">>,
{lstate,<0.626.0>,false},
none,1,
{[],[]},
{user,<<"admin">>,
[administrator],
[{rabbit_auth_backend_internal,none}]},
<<"/">>,<<"q:17252337684797619970874926144232">>,
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[]}}},
{state,
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[],[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[],[]}}},
erlang},
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[]}}},
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[]}}},
{set,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[]}}},
<0.620.0>,
{state,fine,5000,#Ref<0.0.0.30310>},
false,1,
{{0,nil},{0,nil}},
[],
{{0,nil},{0,nil}},
[{<<"exchange_exchange_bindings">>,bool,true},
{<<"connection.blocked">>,bool,true},
{<<"authentication_failure_close">>,bool,true},
{<<"basic.nack">>,bool,true},
{<<"publisher_confirms">>,bool,true},
{<<"consumer_cancel_notify">>,bool,true}],
none,0,none,flow,[]}
** Reason for termination ==
** {function_clause,
[{rabbit_exchange_type_delayed_message,validate,
[{exchange,
{resource,<<"/">>,exchange,<<"mailq-exchange">>},
'x-delayed-message',true,false,false,
[{<<"x-delayed-type">>,longstr,<<"topic">>}],
undefined,undefined,
{[],[]}}],
[{file,"src/rabbit_exchange_type_delayed_message.erl"},{line,61}]},
{rabbit_exchange,declare,6,
[{file,"src/rabbit_exchange.erl"},{line,165}]},
{rabbit_channel,handle_method,3,
[{file,"src/rabbit_channel.erl"},{line,1234}]},
{rabbit_channel,handle_cast,2,
[{file,"src/rabbit_channel.erl"},{line,470}]},
{gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1047}]},
{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,249}]}]}
=ERROR REPORT==== 31-May-2019::09:03:17 ===
Error on AMQP connection <0.618.0> (127.0.0.1:47239 -> 127.0.0.1:5672 - connectionFactory#8139c95:4, vhost: '/', user: 'admin', state: running), channel 1:
{function_clause,
[{rabbit_exchange_type_delayed_message,validate,
[{exchange,
{resource,<<"/">>,exchange,<<"mailq-exchange">>},
'x-delayed-message',true,false,false,
[{<<"x-delayed-type">>,longstr,<<"topic">>}],
undefined,undefined,
{[],[]}}],
[{file,"src/rabbit_exchange_type_delayed_message.erl"},{line,61}]},
{rabbit_exchange,declare,6,[{file,"src/rabbit_exchange.erl"},{line,165}]},
{rabbit_channel,handle_method,3,
[{file,"src/rabbit_channel.erl"},{line,1234}]},
{rabbit_channel,handle_cast,2,
[{file,"src/rabbit_channel.erl"},{line,470}]},
{gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1047}]},
{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,249}]}]}
=WARNING REPORT==== 31-May-2019::09:03:17 ===
Non-AMQP exit reason '{function_clause,
[{rabbit_exchange_type_delayed_message,validate,
[{exchange,
{resource,<<"/">>,exchange,<<"mailq-exchange">>},
'x-delayed-message',true,false,false,
[{<<"x-delayed-type">>,longstr,<<"topic">>}],
undefined,undefined,
{[],[]}}],
[{file,
"src/rabbit_exchange_type_delayed_message.erl"},
{line,61}]},
{rabbit_exchange,declare,6,
[{file,"src/rabbit_exchange.erl"},{line,165}]},
{rabbit_channel,handle_method,3,
[{file,"src/rabbit_channel.erl"},{line,1234}]},
{rabbit_channel,handle_cast,2,
[{file,"src/rabbit_channel.erl"},{line,470}]},
{gen_server2,handle_msg,2,
[{file,"src/gen_server2.erl"},{line,1047}]},
{proc_lib,wake_up,3,
[{file,"proc_lib.erl"},{line,249}]}]}'
=INFO REPORT==== 31-May-2019::09:03:17 ===
accepting AMQP connection <0.1308.0> (127.0.0.1:47419 -> 127.0.0.1:5672)
=INFO REPORT==== 31-May-2019::09:03:17 ===
closing AMQP connection <0.618.0> (127.0.0.1:47239 -> 127.0.0.1:5672 - connectionFactory#8139c95:4, vhost: '/', user: 'admin')
=INFO REPORT==== 31-May-2019::09:03:17 ===
Connection <0.1308.0> (127.0.0.1:47419 -> 127.0.0.1:5672) has a client-provided name: connectionFactory#8139c95:5
=INFO REPORT==== 31-May-2019::09:03:17 ===
connection <0.1308.0> (127.0.0.1:47419 -> 127.0.0.1:5672 - connectionFactory#8139c95:5): user 'admin' authenticated and granted access to vhost '/'
=ERROR REPORT==== 31-May-2019::09:03:28 ===
** Generic server <0.1316.0> terminating
** Last message in was {'$gen_cast',
{method,
{'exchange.declare',0,<<"mailq-exchange">>,
<<"x-delayed-message">>,false,true,false,
false,false,
[{<<"x-delayed-type">>,longstr,
<<"topic">>}]},
none,noflow}}
** When Server state == {ch,running,rabbit_framing_amqp_0_9_1,1,<0.1308.0>,
<0.1314.0>,<0.1308.0>,
<<"127.0.0.1:47419 -> 127.0.0.1:5672">>,
{lstate,<0.1315.0>,false},
none,1,
{[],[]},
{user,<<"admin">>,
[administrator],
[{rabbit_auth_backend_internal,none}]},
<<"/">>,<<"q:20450439579894538978049880093722">>,
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[]}}},
{state,
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[],[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[],[]}}},
erlang},
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[]}}},
{dict,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[]}}},
{set,0,16,16,8,80,48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[]},
{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
[],[]}}},
<0.1309.0>,
{state,fine,5000,#Ref<0.0.0.30583>},
false,1,
{{0,nil},{0,nil}},
[],
{{0,nil},{0,nil}},
[{<<"exchange_exchange_bindings">>,bool,true},
{<<"connection.blocked">>,bool,true},
{<<"authentication_failure_close">>,bool,true},
{<<"basic.nack">>,bool,true},
{<<"publisher_confirms">>,bool,true},
{<<"consumer_cancel_notify">>,bool,true}],
none,0,none,flow,[]}
** Reason for termination ==
** {function_clause,
[{rabbit_exchange_type_delayed_message,validate,
[{exchange,
{resource,<<"/">>,exchange,<<"mailq-exchange">>},
'x-delayed-message',true,false,false,
[{<<"x-delayed-type">>,longstr,<<"topic">>}],
undefined,undefined,
{[],[]}}],
[{file,"src/rabbit_exchange_type_delayed_message.erl"},{line,61}]},
{rabbit_exchange,declare,6,
[{file,"src/rabbit_exchange.erl"},{line,165}]},
{rabbit_channel,handle_method,3,
[{file,"src/rabbit_channel.erl"},{line,1234}]},
{rabbit_channel,handle_cast,2,
[{file,"src/rabbit_channel.erl"},{line,470}]},
{gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1047}]},
{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,249}]}]}
=ERROR REPORT==== 31-May-2019::09:03:28 ===
Error on AMQP connection <0.1308.0> (127.0.0.1:47419 -> 127.0.0.1:5672 - connectionFactory#8139c95:5, vhost: '/', user: 'admin', state: running), channel 1:
{function_clause,
[{rabbit_exchange_type_delayed_message,validate,
[{exchange,
{resource,<<"/">>,exchange,<<"mailq-exchange">>},
'x-delayed-message',true,false,false,
[{<<"x-delayed-type">>,longstr,<<"topic">>}],
undefined,undefined,
{[],[]}}],
[{file,"src/rabbit_exchange_type_delayed_message.erl"},{line,61}]},
{rabbit_exchange,declare,6,[{file,"src/rabbit_exchange.erl"},{line,165}]},
{rabbit_channel,handle_method,3,
[{file,"src/rabbit_channel.erl"},{line,1234}]},
{rabbit_channel,handle_cast,2,
[{file,"src/rabbit_channel.erl"},{line,470}]},
{gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1047}]},
{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,249}]}]}
=WARNING REPORT==== 31-May-2019::09:03:28 ===
Non-AMQP exit reason '{function_clause,
[{rabbit_exchange_type_delayed_message,validate,
[{exchange,
{resource,<<"/">>,exchange,<<"mailq-exchange">>},
'x-delayed-message',true,false,false,
[{<<"x-delayed-type">>,longstr,<<"topic">>}],
undefined,undefined,
{[],[]}}],
[{file,
"src/rabbit_exchange_type_delayed_message.erl"},
{line,61}]},
{rabbit_exchange,declare,6,
[{file,"src/rabbit_exchange.erl"},{line,165}]},
{rabbit_channel,handle_method,3,
[{file,"src/rabbit_channel.erl"},{line,1234}]},
{rabbit_channel,handle_cast,2,
[{file,"src/rabbit_channel.erl"},{line,470}]},
{gen_server2,handle_msg,2,
[{file,"src/gen_server2.erl"},{line,1047}]},
{proc_lib,wake_up,3,
[{file,"proc_lib.erl"},{line,249}]}]}'
=INFO REPORT==== 31-May-2019::09:03:28 ===
closing AMQP connection <0.1308.0> (127.0.0.1:47419 -> 127.0.0.1:5672 - connectionFactory#8139c95:5, vhost: '/', user: 'admin')
=INFO REPORT==== 31-May-2019::09:03:28 ===
accepting AMQP connection <0.1330.0> (127.0.0.1:47421 -> 127.0.0.1:5672)
=INFO REPORT==== 31-May-2019::09:03:29 ===
Connection <0.1330.0> (127.0.0.1:47421 -> 127.0.0.1:5672) has a client-provided name: connectionFactory#8139c95:6
=INFO REPORT==== 31-May-2019::09:03:29 ===
connection <0.1330.0> (127.0.0.1:47421 -> 127.0.0.1:5672 - connectionFactory#8139c95:6): user 'admin' authenticated and granted access to vhost '/'

socket.io transport error with websocket transport

I'm trying to set up a socket.io connection, but the connection keeps closing with a transport error message. Both, client and server, are running socket.io v2.0.3.
Client
var _socket = io({
transports: ['websocket'],
query: {
token: userToken,
roomName: getRoomName(),
},
});
messages:
socket.io-client:manager attempting reconnect +5s
socket.io.min.js:1 socket.io-client:manager readyState closed +0ms
socket.io.min.js:1 socket.io-client:manager opening https://video.twoseven.xyz +1ms
socket.io.min.js:1 engine.io-client:socket creating transport "websocket" +1ms
socket.io.min.js:1 engine.io-client:socket setting transport websocket +1ms
socket.io.min.js:1 socket.io-client:manager connect attempt will timeout after 20000 +2ms
socket.io.min.js:2 WebSocket connection to 'wss://video.twoseven.xyz/socket.io/?token=abcd&roomName=us&EIO=3&transport=websocket' failed: Invalid frame header
r.doOpen # socket.io.min.js:2
r.open # socket.io.min.js:2
r.open # socket.io.min.js:1
r # socket.io.min.js:1
r # socket.io.min.js:1
r.open.r.connect # socket.io.min.js:1
(anonymous) # socket.io.min.js:1
socket.io.min.js:1 engine.io-client:socket socket error {"type":"TransportError","description":{"isTrusted":true}} +733ms
socket.io.min.js:1 socket.io-client:manager connect_error +1ms
socket.io.min.js:1 socket.io-client:manager cleanup +0ms
socket.io.min.js:1 socket.io-client:manager reconnect attempt error +1ms
socket.io.min.js:1 socket.io-client:manager will wait 4769ms before reconnect attempt +1ms
socket.io.min.js:1 engine.io-client:socket socket close with reason: "transport error" +0ms
The Chrome developer console reports the following from the network tab:
General
Request URL:wss://video.twoseven.xyz/socket.io/?token=abcd&roomName=us&EIO=3&transport=websocket
Request Method:GET
Status Code:101 Switching Protocols
Response Headers
Connection:upgrade
Date:Thu, 19 Oct 2017 22:36:52 GMT
Sec-WebSocket-Accept:YJ3aZ2L+X+ANa1bJK3ECO/s7XVE=
Sec-WebSocket-Extensions:permessage-deflate
Server:nginx/1.11.8
Upgrade:websocket
Server
const io = new socketio(server, {pingInterval: 3000, pingTimeout: 10000});
io.set('transports', ['websocket']);
messages:
engine handshaking client "yrFJADAHt-QQZsX6AAAA" +0ms
engine:socket sending packet "open" ({"sid":"yrFJADAHt-QQZsX6AAAA","upgrades":[],"pingInterval":3000,"pingTimeout":10000}) +3ms
engine:socket flushing buffer to transport +1ms
engine:ws writing "0{"sid":"yrFJADAHt-QQZsX6AAAA","upgrades":[],"pingInterval":3000,"pingTimeout":10000}" +1ms
engine:transport setting request +1ms
engine:socket sending packet "message" (0) +9ms
engine:socket flushing buffer to transport +19ms
engine:ws writing "40" +1ms
engine:socket sending packet "message" (2["authenticated"]) +91ms
engine:socket flushing buffer to transport +0ms
engine:ws writing "42["authenticated"]" +1ms
engine:socket transport error +136ms
engine:ws closing +2ms
From the server logs, I see that the connection event has been triggered and executes fine except for the last line which says socket.emit('authenticated');. The transport seems to fail at this point

What happened in chromecast receiver than i get didFailToLoadMediaWithError in sender

then i swoosh media to Chromecast, in app "didFailToLoadMediaWithError" delegate call.
didFailToLoadMediaWithError = Error Domain=com.google.GCKError Code=9 "Request is not allowed in this state" UserInfo=0x171871600 {NSLocalizedDescription=Request is not allowed in this state
how it catch this error in receiver side?
in receiver log i get:
[ 37.552s] [goog.net.XhrIo] Will abort after 10000ms if incomple

chromecast receiver <video> element onEnded

In my application, a user can restart a video from the beginning after it has ended.
To implement this, I have overridden in the custom receiver the receiver library MediaManager.onEnded() method, and send a custom message to the sender, rather than calling resetMediaElement, which is the default behavior of this method.
At this point, the user hits a play button, and the sender calls the RemoteMediaPlayer.play() method, which should cause the receiver library to call the play() method on the <video> element.
But instead, the receiver library sends back a message saying INVALID REQUEST, INVALID_MEDIA_SESSSION_ID.
Also. the receiver library has logged a message saying "
Unexpected command, player is in the IDLE state so the media session ID is not yet valid
But the last state update from the receiver shows the player in the PLAYING state in both the receiver and sender logs.
Here is the receiver log:
::mmOnLoad() mediacast.js:480
url: http://192.168.1.50/apps/chromecast/videos/Inside%20Diamond%20Head-0001.mp4 mediacast.js:498
duration: 0 mediacast.js:500
::showVideo()- message:[object Object] mediacast.js:257
url:http://192.168.1.50/apps/chromecast/videos/Inside%20Diamond%20Head-0001.mp4 mediacast.js:259
::fadeOutOldMediaElement() mediacast.js:384
::mmOnLoad()- presenting video from http://192.168.1.50/apps/chromecast/videos/Inside%20Diamond%20Head-0001.mp4, duration 0 mediacast.js:552
::fadeOutOldMediaElement0() mediacast.js:393
::videoFadedOut()- url: http://192.168.1.50/apps/chromecast/videos/Inside%20Diamond%20Head-0001.mp4 mediacast.js:265
::videoFadedOut()- setting media element [object HTMLVideoElement] mediacast.js:279
::removeMediaElementOrOverlay() mediacast.js:398
::removeOldMediaElement() mediacast.js:432
::removeOverlay() mediacast.js:427
[ 40.701s] [cast.receiver.MediaManager] Metadata loaded
cast_receiver.javascript:574
[ 40.736s] [cast.receiver.MediaManager] Sending broadcast status message
cast_receiver.javascript:574
>>>>>the media element state is paused mediacast.js:603
media element networkState = 2, readyState = 1 mediacast.js:605
[ 40.802s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":1,\"playbackRate\":1,\"playerState\":\"PAUSED\",\"currentTime\":0,\"supportedMediaCommands\":15,\"volume\":{\"level\":0.06666666666666667,\"muted\":false},\"media\":{\"customData\":{\"volume\":0.06666666666666667,\"pauseAfter\":true,\"pauseBefore\":true,\"rotation\":0},\"streamType\":\"BUFFERED\",\"duration\":42.4,\"contentType\":\"video/mp4\",\"contentId\":\"http://192.168.1.50/apps/chromecast/videos/Inside%20Diamond%20Head-0001.mp4\",\"metadata\":{\"metadataType\":1}}}],\"requestId\":1}"}
cast_receiver.javascript:574
::videoLoaded() mediacast.js:291
::videoLoaded0() mediacast.js:302
::addVideo() mediacast.js:421
::videoLoaded1() mediacast.js:309
[ 48.434s] [cast.receiver.IpcChannel] Received message: {"data":"{\"type\":\"PLAY\",\"requestId\":2,\"mediaSessionId\":1}","namespace":"urn:x-cast:com.google.cast.media","senderId":"51:name.renkel.james.mediacast-6"}
cast_receiver.javascript:574
[ 48.440s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.media, 51:name.renkel.james.mediacast-6]: {"type":"PLAY","requestId":2,"mediaSessionId":1}
cast_receiver.javascript:574
[ 48.446s] [cast.receiver.MediaManager] MediaManager message received [51:name.renkel.james.mediacast-6] {"type":"PLAY","requestId":2,"mediaSessionId":1}
cast_receiver.javascript:574
[ 48.449s] [cast.receiver.MediaManager] Dispatching MediaManager play event
cast_receiver.javascript:574
[ 48.457s] [cast.receiver.MediaManager] onPlay
cast_receiver.javascript:574
[ 48.473s] [cast.receiver.MediaManager] Sending broadcast status message
cast_receiver.javascript:574
>>>>>the media element state is buffering mediacast.js:603
media element networkState = 1, readyState = 4 mediacast.js:605
[ 48.491s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":1,\"playbackRate\":1,\"playerState\":\"BUFFERING\",\"currentTime\":0.033322,\"supportedMediaCommands\":15,\"volume\":{\"level\":0.06666666666666667,\"muted\":false}}],\"requestId\":2}"}
cast_receiver.javascript:574
[ 49.071s] [cast.receiver.MediaManager] Buffering state changed, isPlayerBuffering: false old time: 0.033322 current time: 0.433322
cast_receiver.javascript:574
[ 49.077s] [cast.receiver.MediaManager] Sending broadcast status message
cast_receiver.javascript:574
>>>>>the media element state is playing mediacast.js:603
media element networkState = 2, readyState = 4 mediacast.js:605
[ 49.090s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":1,\"playbackRate\":1,\"playerState\":\"PLAYING\",\"currentTime\":0.433322,\"supportedMediaCommands\":15,\"volume\":{\"level\":0.06666666666666667,\"muted\":false}}],\"requestId\":0}"}
cast_receiver.javascript:574
::onEnded(VIDEO) mediacast.js:369
::onEnded- network state:1 mediacast.js:370
::onEnded- ready state:4 mediacast.js:371
::onEnded- paused:true mediacast.js:372
::onEnded- ended:true mediacast.js:373
::sendMessage({"indication":"ended"}) mediacast.js:108
[ 90.955s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:name.renkel.james.mediacast","senderId":"51:name.renkel.james.mediacast-6","data":"{\"indication\":\"ended\"}"}
cast_receiver.javascript:574
[110.341s] [cast.receiver.IpcChannel] Received message: {"data":"{\"type\":\"PLAY\",\"requestId\":3,\"mediaSessionId\":1}","namespace":"urn:x-cast:com.google.cast.media","senderId":"51:name.renkel.james.mediacast-6"}
cast_receiver.javascript:574
[110.350s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.media, 51:name.renkel.james.mediacast-6]: {"type":"PLAY","requestId":3,"mediaSessionId":1}
cast_receiver.javascript:574
[110.358s] [cast.receiver.MediaManager] Unexpected command, player is in IDLE state so the media session ID is not valid yet
cast_receiver.javascript:574ib cast_receiver.javascript:574gb.Gb cast_receiver.javascript:562B.log cast_receiver.javascript:361E cast_receiver.javascript:412Z.M cast_receiver.javascript:1654W.ra cast_receiver.javascript:1181Hb cast_receiver.javascript:885g.dispatchEvent cast_receiver.javascript:856g.M cast_receiver.javascript:1104Hb cast_receiver.javascript:885g.dispatchEvent cast_receiver.javascript:856g.M cast_receiver.javascript:968
[110.362s] [cast.receiver.MediaManager] Sending error message to 51:name.renkel.james.mediacast-6
cast_receiver.javascript:574
[110.368s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"51:name.renkel.james.mediacast-6","data":"{\"requestId\":3,\"type\":\"INVALID_REQUEST\",\"reason\":\"INVALID_MEDIA_SESSION_ID\"}"}
cast_receiver.javascript:574
And here is the sender log:
11-10 13:36:36.631: D/MC_Sender(15051): ::showVideo()- url: http://192.168.1.50/apps/chromecast/videos/Inside%20Diamond%20Head-0001.mp4 11-10 13:36:36.732: D/MC_MainActivity.PagerAdapter(15051): ::setPrimaryItem(0)
11-10 13:36:36.732: D/MC_MainActivity(15051): ::setContentPosition(0)
11-10 13:36:40.325: D/MC_MediaPlayer(15051): ::onMessageReceived(): device-TV Room; namespace-urn:x-cast:com.google.cast.media; message-{"type":"MEDIA_STATUS","status":[{"mediaSessionId":2,"playbackRate":1,"playerState":"PAUSED","currentTime":0,"supportedMediaCommands":15,"volume":{"level":0.06666666666666667,"muted":false},"media":{"customData":{"volume":0.06666666666666667,"pauseAfter":true,"pauseBefore":true,"rotation":0},"streamType":"BUFFERED","duration":42.4,"contentType":"video/mp4","contentId":"http://192.168.1.50/apps/chromecast/videos/Inside%20Diamond%20Head-0001.mp4","metadata":{"metadataType":1}}}],"requestId":4}
11-10 13:36:40.375: D/MC_Listeners(15051): ::onStatusUpdated()- playerState=PAUSED
11-10 13:36:40.426: D/MC_Runner(15051): ::onSenderStateChange(PAUSED)- runState=LOADING
11-10 13:36:40.426: D/MC_Runner(15051): ::setRunState(RUNNING)- stopWhenRunning=false
11-10 13:36:40.426: D/MC_CastFragment(15051): ::runnerUpdate()
11-10 13:36:40.456: D/MC_Listeners(15051): ::onStatusUpdated()- playerState=PAUSED
11-10 13:36:40.456: D/MC_Listeners(15051): ::onMetadataUpdated()- mediaType=MOVIE
11-10 13:36:40.516: D/MC_MainActivity.PagerAdapter(15051): ::setPrimaryItem(0)
11-10 13:36:40.516: D/MC_MainActivity(15051): ::setContentPosition(0)
11-10 13:36:40.806: D/MC_Sender(15051): ::loadMedia()- statusCode: 0; success: true
11-10 13:36:40.806: D/MC_Runner(15051): LoadCallback::callback(true): wasStopped=false
...
11-10 13:38:47.201: D/MC_Sender(15051): ::playMedia()
11-10 13:38:47.391: D/MC_MediaPlayer(15051): ::onMessageReceived(): device-TV Room; namespace-urn:x-cast:com.google.cast.media; message-{"type":"MEDIA_STATUS","status":[{"mediaSessionId":1,"playbackRate":1,"playerState":"BUFFERING","currentTime":0.033322,"supportedMediaCommands":15,"volume":{"level":0.06666666666666667,"muted":false}}],"requestId":2}
11-10 13:38:47.411: D/MC_Listeners(15051): ::onStatusUpdated()- playerState=BUFFERING
11-10 13:38:47.531: D/MC_Runner(15051): ::onSenderStateChange(BUFFERING)- runState=RUNNING
11-10 13:38:47.671: D/MC_MainActivity.PagerAdapter(15051): ::setPrimaryItem(0)
11-10 13:38:47.671: D/MC_MainActivity(15051): ::setContentPosition(0)
11-10 13:38:48.372: D/MC_Sender(15051): ::playMedia()- statusCode: 0; success: true
11-10 13:38:48.382: D/MC_MediaPlayer(15051): ::onMessageReceived(): device-TV Room; namespace-urn:x-cast:com.google.cast.media; message-{"type":"MEDIA_STATUS","status":[{"mediaSessionId":1,"playbackRate":1,"playerState":"PLAYING","currentTime":0.6,"supportedMediaCommands":15,"volume":{"level":0.06666666666666667,"muted":false}}],"requestId":0}
...
11-10 13:39:29.736: D/MC_Listeners(15051): ::onMessageReceived()- nameSpace: urn:x-cast:name.renkel.james.mediacast; message: {"indication":"ended"}
11-10 13:39:29.806: D/MC_Runner(15051): ::onSenderStateChange(ENDED)- runState=RUNNING
...
11-10 13:42:19.918: D/MC_CastFragment(15051): ::onClick()
11-10 13:42:19.918: D/MC_Sender(15051): ::playMedia()
11-10 13:42:20.398: D/MC_MediaPlayer(15051): ::onMessageReceived(): device-TV Room; namespace-urn:x-cast:com.google.cast.media; message-{"requestId":3,"type":"INVALID_REQUEST","reason":"INVALID_MEDIA_SESSION_ID"}
11-10 13:42:20.418: D/MC_Sender(15051): ::playMedia()- statusCode: 1; success: false
I believe that once the video ends, it goes to an IDLE state whether resetMediaElement is called or not. There's different reasons why the status might be IDLE that you can specify: https://developers.google.com/cast/docs/reference/receiver/cast.receiver.media.IdleReason.
It's a bit roundabout, but based on the methods listed at https://developers.google.com/cast/docs/reference/receiver/cast.receiver.MediaManager, you could:
1) check if the video successfully finished playing
2) set the idle reason as cast.receiver.media.IdleReason.FINISHED
Then, in your sender, you can override customizedStatusCallback() to check the status and idle reason and change the status before sending it to your sender so that it can replay correctly.

Resources