open-dis / diswebgateway Goto Github PK
View Code? Open in Web Editor NEWJava web app reads DIS traffic from the network, forwards it to a JavaScript app in the browser, and vice versa.
License: BSD 2-Clause "Simplified" License
Java web app reads DIS traffic from the network, forwards it to a JavaScript app in the browser, and vice versa.
License: BSD 2-Clause "Simplified" License
Any chance you can provide an example of using dis.SetDataPdu with some variable data records.
This code works in GraalVM.
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class Foo {
static public void main(String [] args) {
try
{
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("nashorn");
engine.eval("print('Hello, World')");
}
catch(Exception e)
{
System.out.println(e);
}
}
}
================================================================
This code does not work in DISWebGateway. Can i get a Java version # when running the run target under ant?
$ sudo ant run
This is a Linux 5.8 system.
See below
On 2/21/21 9:53 PM, John Carlson wrote:
I've been trying to get open-dis' DISWebGateway running, and got the following script issue. I think it's because OpenJDK does not use a scripting engine like Nashorn.
I will likely move to GraalVM if there are no other solutions.
run:
[java] Loaded configuration properties
[java] class edu.nps.moves.gateway.Configuration
[java] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[java] SLF4J: Defaulting to no-operation (NOP) logger implementation
[java] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[java] Started DIS listening on UDP port 1194
[java] Configured to not use redis server
[java] Starting websocket server on TCP port 8282
[java] Starting https server on TCP port 443
[java] WebSocket Opened
[java] java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.eval(String)" because "engine" is null
[java] WebSocket Closed. Code:1011 Reason:WebSocketException
[java] WebSocket Opened
[java] java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.eval(String)" because "engine" is null
[java] WebSocket Closed. Code:1011 Reason:WebSocketException
I have an instance of this running in a Docker container. I modified the src in Configuration.java in my copy so that the ports are configurable. Maybe this is something you could add or allow me to submit a PR if it is useful to others? Thanks.
Here's the gist:
String webserverPort = settings.getProperty("webserverPort");
String httpsWebserverPort= settings.getProperty("httpsWebserverPort");
// Overrides the default ports if the ENV VARS exist
if ( System.getenv("HTTP_WEBSERVER_PORT") != null )
{
webserverPort = System.getenv("HTTP_WEBSERVER_PORT");
}
if ( System.getenv("HTTPS_WEBSERVER_PORT") != null )
{
httpsWebserverPort = System.getenv("HTTPS_WEBSERVER_PORT");
}
HTTP_WEBSERVER_PORT = Integer.parseInt(webserverPort);
HTTPS_WEBSERVER_PORT = Integer.parseInt(httpsWebserverPort);](url)```
https://github.com/coderextreme/DISWebGateway/ You can do a pull request to see my changes, mostly to use GraalJS instead of Nashorn.
Please integrate my GraalJS changes. Feel free to grab your own version of GraalJS jars
Note that there are still issues with the WebSocket being closed??? I'm not sure if it should be closed or not?
Thanks!
John
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.