const electron = require('electron');
const { app, BrowserWindow } = electron;
let mainWindow;
app.on('ready', () => {
mainWindow = new BrowserWindow({
width: 1920,
height:1080,
"web-preferences" : { "web-security" : false }
});
mainWindow.setTitle('iFlexRTS Studio');
mainWindow.loadURL('http://localhost:8081');
mainWindow.on('closed', () => { mainWindow = null; });
});
Which I subsequently run with;
electron main.js
Although the HTTP stuff fires up Ok, as soon as I try to make a WAMP connection I get;
iflex.js:61 > Initializing ......ws://localhost:8081/ws
iflex.js:36 # iflex.js:62 > Autobahn version ..0.10.1
iflex.js:36 # iflex.js:67 > Connecting with (guest) credentials
autobahn_min.js:1142 Refused to set unsafe header "Sec-WebSocket-Version"(anonymous function) @ autobahn_min.js:1142
autobahn_min.js:1142 Refused to set unsafe header "Sec-WebSocket-Key"(anonymous function) @ autobahn_min.js:1142
autobahn_min.js:1142 Refused to set unsafe header "Sec-WebSocket-Protocol"(anonymous function) @ autobahn_min.js:1142
autobahn_min.js:1142 Refused to set unsafe header "Sec-WebSocket-Extensions"(anonymous function) @ autobahn_min.js:1142
http://localhost:8081/ws Failed to load resource: the server responded with a status of 426 (HTTP Upgrade header missing)
Anyone any idea on what's causing this / how to get around it .. ??
tia
Gareth.
const electron = require('electron');
const { app, BrowserWindow } = electron;
let mainWindow;
app.on('ready', () => {
mainWindow = new BrowserWindow({ width: 1920, height:1080, });
mainWindow.setTitle('iFlexRTS Studio');
mainWindow.loadURL('file:///home/gareth/iFlexStudio/master/client.html');
mainWindow.on('closed', () => { mainWindow = null; });
});
python3 server.py &
electron main.js
Connected!
client.html:35 Text message sent.
client.html:16 Text message received: Hello, world!
client.html:46 Binary message sent.
client.html:23 Binary message received: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
Failed to load resource: the server responded with a status of 426 (HTTP Upgrade header missing)
Failing Websocket opening handshake ('HTTP Upgrade header missing')
<script>
var isOnNodeJs = false;
if(typeof process != "undefined") {
isOnNodeJs = true;
}
</script>
<script>
if(isOnNodeJs) {
var autobahn=require("/usr/local/lib/node_modules/autobahn/lib/autobahn.js");
} else {
$.getScript("js/autobahn_min.js" );
}
</script>
try {// for Node.jsvar autobahn = require('autobahn')} catch (e) {// for browsers (where AutobahnJS is available globally}
Hi Gareth,
when running under node, the autobahnjs from npm should be used and imported using require. This is expected for node libraries and works perfectly.
Cheers,
Tobias
Sent from Mobile (Google Nexus 5)
--
You received this message because you are subscribed to the Google Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+unsubscribe@googlegroups.com.
To post to this group, send email to autob...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/c9d2ec70-3a4b-4f94-9ec4-f3d9b3d7474d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.