I'm using opentok client JS api OpenTok.js 2.14.6 753045900, to set up a video conferencing app. Intermittently, it throws errors into chrome console:
WebSocket connection to 'wss://mantis002-ams.tokbox.com/rumorwebsocketsv2?socketId=12796b11-4174-431e-980f-52c29c32aa0d&attempt=b58d3a4d-7721-4e93-b39b-76224b00864a' failed: WebSocket is closed before the connection is established.
WebSocket connection to 'wss://mantis002-ams.tokbox.com/rumorwebsocketsv2?socketId=12796b11-4174-431e-980f-52c29c32aa0d&attempt=0d49b33e-33b9-4eec-a6d4-80ea6d7908ec' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
OT:RumorSocket:1 Error code unavailable.
OT.Raptor.Socket error: e {code: 4020, message: "Error code unavailable."}
OT_SOCKET_CLOSE_FALLBACK_CODE: Error code unavailable.
OT.exception :: title: undefined (4020) msg: Error code unavailable.
s {code: 4020, message: "Error code unavailable.", name: "OT_SOCKET_CLOSE_FALLBACK_CODE", stack: "Error: Error code unavailable.↵ at https://stat…tatic.opentok.com/v2/js/opentok.min.js:29:247034)"}
An error occurred in an event handler TypeError: Cannot read property 'id' of
null
at index.js:455
at P (RaptorSocket.js:75)
at r (RaptorSocket.js:265)
at d.triggerCallback (Dispatcher.js:32)
at n.<anonymous> (SessionDispatcher.js:179)
at n.emit (events.js:84)
at d.trigger (eventing.js:321)
at d.emit (eventing.js:330)
at RaptorSocket.js:279
How to correctly handle this situation, because seems like reconnection doesn't work inside OpenTok.js?
And when I tried to recreate session I received
OT.exception :: title: Unexpected Server Response (2001) msg: Unexpected server response. Try this operation again later.
{ code: 2001, message: "Unexpected server response. Try this operation again later.", name: "OT_UNEXPECTED_SERVER_RESPONSE", stack: "Error: Unexpected server response. Try this operat…/static.opentok.com/v2/js/opentok.min.js:23:8742)"}
mixin.js:23 OT:RumorSocket:49 The connection is being terminated because the endpoint has indicated that reconnections are not available. (CLOSE_UNSUPPORTED)
TokBox Developer Evangelist here.
Could you please email support#tokbox.com with the sessionId along with the logs? The support team will be able to help you discover the underlying issue. You can also use the Session Inspector tool for a high-level summary that may help you pinpoint the connection errors.
Related
I am using https://www.paypal.com/sdk/js?client-id=ddd¤cy=EUR
with frontEnd implementation, On Production I am getting this error.
paypal error Api: /smart/api/order/29B71296JP6358523/capture returned ack: permission_denied (Corr ID: -----)
I am not sure why and when it occurs as i am logging the caught error in OnError method.
Can someone help me out that why is it occuring...
Issue
Subscriber video for device not being added to dom element after establishing OpenTok session.
Expected behavior
After the OpenTok session receives the streamCreated event:
subscribing the session to the event.stream,
passing in the target dom element,
providing the subscriber's properties, and
providing a callback
should initialize the subscriber stream and populate the provided dom element with the video stream or fail if an error occurs during the subscription process.
this.session.on({
streamCreated: event => {
console.log('----- Event Stream: ', event.stream);
let subscriberProperties = {
width: '100%',
height: '100%',
insertMode: 'append'
};
this.subscriber = this.session.subscribe(event.stream, 'subscriberContainer', subscriberProperties, err => {
if (err) {
console.log('----- Subscriber subscribe error: ', err);
}
else {
console.log('----- Subscriber added.....');
}
});
}
});
Actual behavior
streamCreated fires and the stream is created. OpenTok throws a warning:
RTCIceServer.url is deprecated, please use RTCIceServer.urls instead.
Followed by these errors:
Error while setting RemoteDescription
--
DOMException: Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: rtcpMuxPolicy is 'require', but media description does not contain 'a=rtcp-mux'..
--
PeerConnection.offerProcessor Error while setting RemoteDescription: OperationError: Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: rtcpMuxPolicy is 'require', but media description does not contain 'a=rtcp-mux'.. in state
{
connectionState: undefined,
iceConnectionState: "new",
iceGatheringState: "new",
signalingState: "have-remote-offer"
}
--
OT.exception :: title: Connection Failed (1013) msg: OT.Subscriber PeerConnection Error: PeerConnection.offerProcessor Error while setting RemoteDescription: OperationError: Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: rtcpMuxPolicy is 'require', but media description does not contain 'a=rtcp-mux'..
--
Unhandled rejection null
--
OT_SET_REMOTE_DESCRIPTION_FAILED: SetRemoteDescription: Subscriber PeerConnection with connection (not found) failed: PeerConnection.offerProcessor Error while setting RemoteDescription: OperationError: Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: rtcpMuxPolicy is 'require', but media description does not contain 'a=rtcp-mux'..
The subscription error comes back as:
{
code: 1501,
message:"SetRemoteDescription: Subscriber PeerConnection with
connection (not found) failed:
PeerConnection.offerProcessor Error while setting
RemoteDescription: OperationError: Failed to set remote offer
sdp: Session error code: ERROR_CONTENT. Session error
description: rtcpMuxPolicy is 'require', but media description
does not contain 'a=rtcp-mux'.."
name:"OT_SET_REMOTE_DESCRIPTION_FAILED"
stack:"Error: SetRemoteDescription: Subscriber PeerConnection with
connection (not found) failed: PeerConnection.offerProcessor
Error while setting RemoteDescription: OperationError: Failed
to set remote offer sdp: Session error code: ERROR_CONTENT.
Session error description: rtcpMuxPolicy is 'require', but
media description does not contain 'a=rtcp-mux'..↵ at
file:///android_asset/www/src/scripts/opentok.min.js:1:365616
at S.it
(file:///android_asset/www/src/scripts/opentok.min.js:1:545734)
at
file:///android_asset/www/src/scripts/opentok.min.js:1:252654
}
Both publishers on the web and device send the outgoing streams and properly establishes. The web subscriber properly receives the stream from the device and establishes. The device subscriber does not receive the stream, errors out, and never establishes.
Notes
Outgoing streams are fine. Both publisher streams are established and the subscription stream on the web portal end is established. The incoming subscription stream is never established on the device.
Is it possible for Axios to differentiate between the following:
A request which fails because the client has no network connection at
the point when the request was made - (ERR_CONNECTION_REFUSED).
A request which fails because network connectivity is lost after the
request was made but before the response was received - (ERR_INTERNET_DISCONNECTED).
It seems that in both cases, all we get back is a rather unhelpful "Network Error" message...
The Axios documentation (https://github.com/axios/axios#handling-errors) suggests that in the latter case, error.request should be populated, but I have been unable to replicate any scenario where error.request exists. In both of the above scenarios, I get an error object looking like this:
{
config: { ... },
response: undefined,
message: "Network Error",
stack: "Error: Network Error at createError (http://localhost:3000/static/js/bundle.js:1636:15) at XMLHttpRequest.handleError (http://localhost:3000/static/js/bundle.js:1170:14)"
}
I don't know exacly if you can get ERR_CONNECTION_REFUSED but ERR_INTERNET_DISCONNECTED you can get use native web Network Information API,take a look on snippet bellow:
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
console.log(connection);
When connection.type: "none" mean that you are ERR_INTERNET_DISCONNECTED, maybe you can explore this solution.
you can read complete documention here, cya
I'm running socket.io on node.js and the socket.io client on an Apache website. If I don't start the node.js server and load the client page, the error event is triggered with an empty error message, which results in the following console output:
GET http://example.com:1337/socket.io/1/?t=1359731838906 socket.io.js:1659
Socket.handshake socket.io.js:1659
Socket.connect socket.io.js:1699
Socket socket.io.js:1551
io.connect socket.io.js:94
(anonymous function) general.js:7
(anonymous function)
What can I do to stop this error being written to the console?
You can not "catch" these errors in the sense that they are not appearing in the console but you can still act upon them by listening for 'connect_error', 'connect_failed' and 'disconnect' of the socket and then either handling them directly or redirecting them to a custom function like handleErrors():
const socket = io.connect(url, { reconnection: false })
socket.on('update', data => console.log(data))
socket.on('connect_error', err => handleErrors(err))
socket.on('connect_failed', err => handleErrors(err))
socket.on('disconnect', err => handleErrors(err))
The only way to hide that error is by never calling io.connect in the first place – which of course would mean your app's socket functions wouldn't work even if the server is up.
It's important to understand that the error message you're seeing is neither something placed there by socket.io itself (via console.error()) nor is it an uncaught JS Exception.
The error message is placed in your console by the browser's XHR object itself. It's telling you that a XHR request has failed (since your server isn't running). The stack trace is telling you what code initiated the XHR request; it isn't a trace of an actual Exception.
Since socket.io must make a request to the server, there's no way it (or you) could prevent that error message from appearing in the console if the server isn't responding.
try
socket.on('connect_failed', function(){
console.log('Connection Failed');
});
Not tested this. Found it here Node.js socket.io-client connect_failed / connect_error event
If you're using Socket.io v4 and need to capture middleware errors, try
// client-side
socket.on("connect_error", (err) => {
console.log(err.message); // prints the message associated with the error
});
source https://socket.io/docs/v4/middlewares/#handling-middleware-error
I'm doing a simple UDP "send" using Node's inbuilt datagram UDP socket :
http://nodejs.org/docs/v0.3.1/api/dgram.html
The destination of the message is a domain name that has to be resolved by DNS before transmission.. node.js handles this.
In the event that DNS resolution fails dgram throws a "ENOTFOUND Domain Not Found" error and passes it to the callback that I've registered.
My code is like this:
client = dgram.createSocket("udp4");
client.send(message,
0,
message.length,
this.port,
this.address,
function(err, bytes) {
if (err) {
//get rid of error??
}
}
);
client.close();
I'm not particularly interested in the error.. if it fails, it fails, its not important to the business rules of the application. I'll log it to console for completeness.. BUT I cant stop this exception walking back up the stack and bringing down the application. How do I handle this error?
I dont wish to put a global uhandled exception handler in place just for this. I've tried rethrowing the error inside the callback within a Try/Except handler.. that didn't work.
Any thoughts?
Thanks for reading.
You need to listen for an error event from the socket. If you don't, then node will convert this to an exception. Do not try to handle this with uncaughtException, because the only safe thing to do from uncaughtException is log then exit.
Here is an example of listening for error and causing an intentional DNS error:
var dgram = require('dgram');
var message = new Buffer("Some bytes");
var client = dgram.createSocket("udp4");
client.on("error", function (err) {
console.log("Socket error: " + err);
});
client.send(message, 0, message.length, 41234, "1.2.3.4.5");
This should print:
Socket error: Error: ENOTFOUND, Domain name not found
And the program will continue running.