B4J Question [BANanoServer] [jRDC2]

LJG

Member
Hello all,

I am studying how to use BANanoServer with jRDC2 in the proper manner. I have a very simple setup that I need help with. Here is the breakdown:

1) On the Client side I have the following:
On the Client Side:
Private Sub SKButton3_Click (event As BANanoEvent)
    Dim value As Int = 0
    Dim error As String
    Dim prom As BANanoPromise = ws.RunFunctionWithResult("FillAnimalsTable_BAN", Null)
    prom.Then(value)
        Log("Promise value: " & value)
    prom.Else(error)
        Log("Promise error: " & error)
    prom.end
End Sub

2) On the Server side, I have the following:
On the Server Side:
Sub FillAnimalsTable_BAN As ResumableSub
    Dim cmdList As List
    cmdList.Initialize
    'Generate 2 animals. Create the DBCommands.
    For i = 1 To 2
        jRDC2Utils.AddCommand(cmdList, "insert_animal", Array("Horse " & i))
    Next
    'Execute the DBCommands.
    Wait For (jRDC2Utils.ExecuteCommands(cmdList)) complete (Result As Int)
    Log("Server Side Result: " & Result)
    Return Result
End Sub

3) The Client code does get to the server and the server-side successfully adds the 2 horses to the database - but the client-side promise does not return the promised int value (the number 2).

4) On the Server side console, I get: "Server-Side Result: 2" (so that's working).

5) On the Client side console, I get:

ReconnectingWebSocket sendPromise ws://192.168.1.15:17178/ws/www/about {"type":"event","event":"banano_parseevent","params":{"eventname":"fillanimalstable_ban","request_id":3,"eventparams":""}}
bananocore.js:9 ReconnectingWebSocket onmessage ws://192.168.1.65:17178/ws/www/about {"prop":"{\"request_id\": 3, \"data\": b4j.example.serverabout$ResumableSub_FillAnimalsTable_BAN@52d10fb8}","etype":"eval"}

ReconnectingWebSocket onmessage ws://192.168.1.15:17178/ws/www/about {"prop":"{\"request_id\": 3, \"data\": b4j.example.serverabout$ResumableSub_FillAnimalsTable_BAN@52d10fb8}","etype":"eval"}

Uncaught SyntaxError: Unexpected token ':'
at new Function (<anonymous>)
at b4j_eval (bananocore.js:12)
at p._B._ws.onmessage (browserabout.js:1161)
at HTMLDivElement.<anonymous> (bananocore.js:9)
at WebSocket.s.onmessage (bananocore.js:9)

The javascript function affected is:
Javascript Line:
(function anonymous(
) {
{"request_id": 3, "data": b4j.example.serverabout$ResumableSub_FillAnimalsTable_BAN@1804f60d}
})

It's that "unexpected token" that I cannot figure out (I am assuming that is the issue).

Your help would be greatly appreciated, thank you.
 
Top