Syntax error in websocket in Microsoft Edge - websocket

Actually, the problem is the project works fine in localhost running in MS Edge, but not in the live site.
I tried to reproduce this error in localhost. Running the code with breakpoints to exactly to find where the error occurs.
This is the line where error occurred:
'wss://' + location.hostname + ':' + location.port + '/websocket/videovisit';

For example,
'wss://' + location.hostname + ':' + location.port + '/websocket/videovisit' as far this line is considered in localhost it will set the value as 'wss://localhost:8080/websocket/videovisit',it works fine.
While in the live site the value will be set as 'wss://www.example.com:/websocket/videovisit', this line works fine in chrome, firefox except in edge because of this ":".Avoid this :(colon) in edge browser to eliminate syntax error in web socket.

Related

How can I test a WebSocket STOMP using JMeter

I have followed this question But things did not work properly because when I try to download JMeterWebSocketStompSampler-0.2.jar, It is not Found. But other jar files are found and are in place, here's a sample of my samplers screenshot attached.
Are there any suggestions to be able to test a local STOMP ?? I also tried APIC extension in chrome and it is failing, I am attaching an image.
Any Suggestions?
Thanks
It looks like you can use WebSocket Samplers by Peter Doornbosch (can be installed using JMeter Plugins Manager), some sample code snippets are available in Using Websocket samplers in JMeter with STOMP plugin issue discussion, for instance this one:
String s = "CONNECT\n" +
"login:${wsToken}\n" +
"passcode:\n" +
"accept-version:1.1,1.0\n" +
"heart-beat:20000,0\n" +
"\n" +
'\0' // note: NULL char at end
;
vars.put("wsStompData", s);

Nightwatch expected visible but got not visible

I have been setting up some tests with Nightwatch. I ran the following basic test on their website.
module.exports = {
'Search on google': (browser) => {
browser
.url('http://www.google.com')
.waitForElementVisible('body', 1000)
.setValue('input[type=text]', 'nightwatch')
.waitForElementVisible('button[name=btnG]', 1000)
.click('button[name=btnG]')
.pause(1000)
.assert.containsText('#main', 'Night Watch')
.end()
},
after: (browser) => {
browser.end()
}
};
And got the following error:
Timed out while waiting for element <button[name=btnG]> to be visible for 1000 milliseconds. - expected "visible" but got: "not visible"
My first attempt at correcting was to change .waitForElementVisible('button[name=btnG]', 1000) to 10000 but still ended up getting Timed out while waiting for element <button[name=btnG]> to be visible for 10000 milliseconds. - expected "visible" but got: "not visible".
Inspecting the google search button showed me that the button name was actually btnK so I tested that but it didn't work either returning expected "visible" but got: "not found".
Very stumped and not sure where to go from here. Anyone have an idea?
Any chance you're running this on Chrome 65? A recent change essentially causes setValue to error out. Your Nightwatch test would then fail on the next step. The best solution is to update your Chromedriver to 2.36.
Please see the answers here: unknown error: call function result missing 'value' for Selenium Send Keys even after chromedriver upgrade
I was facing the same issue. I had installed ChromeDriver from NPM it was v2.45.. My Chrome version was v69. When I downloaded the chrome driver from this link- https://chromedriver.storage.googleapis.com/index.html?path=2.36/ and updated my nightwatch.json to point to this downloaded chrome driver version using server_path. This solved the issue.

Fix error "at=error code=H10 desc "app crashed" method = GET

I am getting an error in my heroku logs that I cannot figure out how to fix.
I read through a thread on stack overflow Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch). This seemed very similar to my problem.
I have developing my app with the express generator. So my bin folder holds the port information
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
I know the process.env.PORT is necessary to open my heroku site. I initially assumed this would work well enough as my app.js only had a reference to express.
I could not get the page to open so I added the port information to my app.js file in addition to the bin folder.
app.set('port', (process.env.PORT || 3000));
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
});
I got this github page https://github.com/heroku/node-js-getting-started/blob/master/index.js#L16.
However, I am still getting the same error. I do not know where else to look. The only additional note I see with an error is
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch.
These seem to be targeting the same problem.
What else is your app doing?
Note that the error indicates you didn't bind to the socket within 60 seconds. I agree that your app.set('port', (process.env.PORT || 3000)); looks just fine.
Maybe it's something else - maybe you're making a web callout or something before it even gets to that point, and that's what's consuming the time?

Microsoft Edge does not allow localhost loopback for websockets

I have web-site and desktop application, and I want to connect them by websockets. So my web-site tries to connect to wss://localhost:8080, for example.
It works in IE11, but in "MS Edge" I have an error:
Cross zone request is not allowed
I have this problem on Win10 10240, so the flag "Allow localhost loopback" is enabled by default, and it did not help.
When I use CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe" or this utility, all works as expected.
So, is this a case, that in new builds of "MS Edge" loopbacks are allowed for http, but not allowed for websockets?
And if so, is it possible to make some workaround, and not to force my users to run some shell comand or to download externall utility?
Related question: Can't open localhost in Microsoft Edge (Project Spartan) in Windows 10 preview
In the Microsoft Edge browser type "About:flags" in the title bar (search bar). No quotes, Tick/Un-tick the "allow Localhost Loopback" feature.
Edge on Win Build 10240. (still works upto New Edge (chrome based))
After some research I found the source of error. Here is my repo, to reproduce error: https://github.com/AZaviruha/ms-edge-ws-strange
In short, when you call new WebSocket in MS Edge, it does not generate exception, when you call it with wrong "local"-host argument:
var socket, path;
var hosts = ['localhost', '127.0.0.1'];
for (var i in hosts) {
path = 'ws://'+hosts[i]+':9446';
console.log( '===> Tested path :: ', path );
try {
socket = new WebSocket( path );
break;
}
catch ( e ) {
// !!! Never shown !!!
console.error( '===> WebSocket creation error :: ', e );
}
}
Because of this, you can't "retry" to connect with different hosts.
By the way, if you try non-local non-existent host, it will generate exception!
This recently happened to me again after doing the Windows 10 Creator's Update (1703).
But the fix was easy. I had to
Check the "allow Localhost Loopback" feature mentioned by #Narcarsiss (not sure if that got disabled in the update, or I just never checked it myself previously).
Specify the protocol in the address bar (http://localhost:5000/ instead of just localhost:5000/).
After doing both I was able to access my localhost sites again in MS Edge.

webpage.open() never calls callback

I'm using PhantomJS 1.8.2 to run some Jasmine unit tests using JsTestDriver. The tests run fine using Chrome, but about half the time when using PhantomJS, the test result is that no test cases were found.
I've narrowed the issue down to PhantomJS failing to open the local JsTestDriver page (http://localhost:9876/capture). Here's how to reproduce this, about 50% of the times, the Loaded ... with status ... message is never shown:
Start JsTestDriver server locally
Run phantomjs phantomjs-jstd-bridge.js
The file phantomjs-jstd-bridge.js looks like this:
var page = require('webpage').create();
var url = 'http://localhost:9876/capture';
console.log('Loading ' + url);
page.open(url, function(status) {
console.log('Loaded ' + url + ' with status ' + status);
});
The first log line (Loading ...) is always displayed, but the second line coming from the callback is only printed about half the time.
What could be the cause for this? Opening the URL in question in a web browser works fine every time.
Is there any way to get more info on why PhantomJS does not call the callback?
Check some tips mentioned in the Troubleshooting wiki page. Particularly useful is tracking the network transfer activity as it may indicate whether some resources are not sent properly or other similar problems.

Resources