B4J Question Http sessions with WebSockets

jahswant

Well-Known Member
Licensed User
Longtime User
With the new release http sessions are not created automatically for WebSockets. I added a filter handler to create it with this post : https://www.b4x.com/android/forum/threads/safari-session-variables-in-b4j-v4.61652/post-389898. UPDATED also to b4j_ws.js v0.93 but I still fall in this error :

B4X:
java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (HttpSession).
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
    at anywheresoftware.b4j.object.WebSocketModule$Adapter$ThreadHandler.run(WebSocketModule.java:204)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.RuntimeException: Object should first be initialized (HttpSession).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:49)
    at anywheresoftware.b4j.object.HttpSessionWrapper.SetAttribute(HttpSessionWrapper.java:78)
    at b4j.example.login._websocket_connected(login.java:216)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    ... 7 more

Seems like I'm missing something. I don't know what.
 
Top