B4J Question web socket session null

LucaMs

Expert
Licensed User
Longtime User
After some change (?) now I have two versions of a b4j web socket server.

With the second one, the client (b4a) connects and the server saves client data on a db; the web socket connection seems to be still open but if I try to access to its session (ws.session.SetAttribute) I get an error, which means, I think, that the session object is null:

java.lang.NullPointerException
at anywheresoftware.b4j.object.WebSocket.getSession(WebSocket.java:344)


Can a ws be active without a session? What may have happened?


Thank you
 

LucaMs

Expert
Licensed User
Longtime User
This is really strange.

Server routine, invoked by client:
B4X:
Public Sub FromClient_Registration(Params As Map)
    Log("FromClient_Registration - is open: " & ws.Open)
  Private UserName, PW, NickName, EMail, Avatar As String
 
   UserName = Params.Get("UserName")
   PW = Params.Get("PW")
   NickName = Params.Get("NickName")
   Avatar = Params.Get("Avatar")
'...
' save to db
.

The "log line" raises an error:
at anywheresoftware.b4j.object.WebSocket.getOpen(WebSocket.java:93)

but if I remove that Log, data will be saved to the db. (I need to set a session attribute after this and I get a similar error)
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

I have same question now. Could you tell me how do you solve it ?
 
Upvote 0
Top