Dmitriy
Dmitriy

Reputation: 455

javafx.WebView not load page with socket.io

I have a 'nodeJs' server using 'expressJs' and 'socket.io'. The page opens fine unless I use 'socket.io. If you use 'socket.io', then it throws an 'Unknown error' error:

const app = require('express');
const server = require('http').Server(app);
const io = require('socket.io')(server, {}); // this line causes 'Unknown error' on page load

It doesn't matter what parameters to use in {}. If you just create a variable const io = require('socket.io'), then the page will open successfully.

Does anyone know what could be causing this and how to resolve it? Maybe because the browser does not understand some types and therefore gives an error? I read online that WebView used to use the Nashorn API, which allowed plugin libraries to convert their data to a Java-friendly type (serializing complex objects to JSON) and apparently avoided errors, but it has been removed.

Update: I found https://github.com/socketio/socket.io-client-java, maybe this is the right direction in solving the question, but I don't understand how to use it with webview...

Upvotes: 0

Views: 112

Answers (0)

Related Questions