Open jvilk opened 11 years ago
Or maybe they should:
Then we don't have to do anything but detect the WebSock
object provided by WebSockify.
I'm in favor of the latter, perhaps with a configurable WebSock
parameter somewhere that defaults to null
. I'm not a huge fan of changing behavior based on whether an arbitrary value is defined with the name WebSock
.
How else should we test for WebSockify? Testing for global objects is how you detect whether or not things are present in the browser world.
Unless you mean check once and set a bool. I'm all for that.
I mean we can pass in the WebSock
object to some constructor somewhere, instead of testing for its presence.
Ah, gotcha. Probably during JVM instantiation or something. I'll consider it!
The change I made successfully defines the Websock
object in WebSocket-enabled and non-WebSocket-enabled browsers.
The next step is to:
Websock
part of the constructor for e.g. JVM/runtime state.@jvilk
I am trying to run a Java program using some classes in java.net package ( mainly class java.net.URL and java.net.URLClassLoader ) in doppiojvm, i got some error.
Uncaught ReferenceError: Websock is not defined
java_net_PlainSocketImpl.socketCreate(Z)V @ java_net.ts:169
Method.code @ methods.ts:293
NativeStackFrame.run @ threading.ts:295
JVMThread.run @ threading.ts:671
(anonymous function) @ threadpool.ts:83
i @ main.ts:158
I guess it's related to this issue, and if i should do something when doppio init.
@CoderRooftrellen Just created a related issue: https://github.com/plasma-umass/doppio/issues/418
I haven't tested the net
code in awhile, so it could be broken. I'll take a look once I fix the build issues.
@jvilk Thanks.
I ran out of time today since the build issues took awhile. It's on my todo list for tomorrow.
@CoderRooftrellen For the specific issue you mention "Websock is not defined", the solution I think is to include the script from doppio/vendor/websockify/websock.js
on the page, before starting the doppio-jvm.
@jvilk However, after doing that, I see another error:
Uncaught Error: Assertion failed: Int value is out of bounds: 4026531841
assert @ assert.ts:8
validateReturnValue @ threading.ts:1231
JVMThread.asyncReturn @ threading.ts:1035
Opcodes._return_32 @ opcodes.ts:1153
BytecodeStackFrame.run @ threading.ts:254
JVMThread.run @ threading.ts:800
(anonymous function) @ threadpool.ts:83
i @ browserfs.min.js:8
@hrj flatThrwoableToJs
is spelled wrong, did you mean flatThrowableToJs
? Also, That's not doppio code :P.
@jimfb Hawkeye! Yeah, the second error was not relevant to doppio. I have edited it out.
I'm working on this in #462.
In older browsers without WebSockets, WebSockify attempts to load a Flash file as a polyfill.
But it doesn't load properly.
WebSockify uses its own
load_scripts
function to dynamically pull in polyfills at runtime, which clashes with RequireJS. In addition, it requires access to the SWF file in the build directory at a particular location relative to the WebSockify JavaScript file.Proposed solution: