Ola
Download
I'm attempting to implement jRDC2 with my test project with the BANanoServer. I am able to perform CREATE, UPDATE, DELETE calls, however each of them results in an error.
Line 41203 has this kind of code.
I am calling this BROWSERIndex call
Well I'm not sure if its the right way to do it because an jRDC2 call is a ResumableSub. JRDC2OnBrowser calls the JRDC2OnServer call. Whilst the sql commands are executed on the underlying db, the above error is always a result. Perhaps Im doing something wrong and would appreciate any assistance I can get.
I have attached the source code and the SQL file for the backend database. There is a jRDC b4j project and some external libraries on the repo link above.
I thank you.
PS: the config.properties files on both projects hold the settings for the projects, the UI is on 55056 and the JRDC2 on 17178 (ports)
Download
I'm attempting to implement jRDC2 with my test project with the BANanoServer. I am able to perform CREATE, UPDATE, DELETE calls, however each of them results in an error.
Line 41203 has this kind of code.
B4X:
// [26] Public Sub Initialize
_B.initialize=function() {
// [29] If ws.IsSupported Then
if (!(typeof WebSocket === 'undefined')) {
// [31] ws.Initialize( {1} & BANano.Location.GetHost & {2} & BANano.StaticFolder & {3} )
_B._ws=MakeSocket("ws://"+window.location.host+"/ws/"+"www"+"/index", true);
if (typeof _B.websocket_disconnected==="function") {_B._ws.onclose = function(e) {_B.websocket_disconnected(e);
}};
if (typeof _B.websocket_onerror==="function") {_B._ws.onerror = function(e) {_B.websocket_onerror(e);}};
_B._ws.onmessage = function(e) {if(IsJson(e.data)){var ed=JSON.parse(e.data);
ed.hasOwnProperty("etype")?"runmethod"===ed.etype||"runmethodWithResult"===ed.etype||"setAutomaticEvents"===ed.etype||("runFunction"===ed.etype?b4j_runFunction(_B,ed.prop,ed.value):"runFunctionWithResult"===ed.etype?b4j_sendData(this,b4j_runFunction(_B,ed.prop,ed.value)):"eval"===ed.etype?b4j_eval(ed.value,ed.prop):"evalWithResult"===ed.etype?b4j_sendData(this,b4j_eval(ed.value,ed.prop)):"alert"===ed.etype?window.alert(ed.prop):_B.websocket_onmessage(e)):_B.websocket_onmessage(e)}else _B.websocket_onmessage(e)};
if (typeof _B.websocket_onopen==="function") {_B._ws.onopen = function(e) {_B.websocket_onopen(e);}}
if (typeof _B.websocket_onconnecting==="function") {_B._ws.onconnecting = function(e) {_B.websocket_onconnecting(e);}};
// [32] End If
}
// End Sub
};
I am calling this BROWSERIndex call
B4X:
'process records to the MySQL Database, receive from router
Sub JRDC2OnBrowser(payload As Map) 'ignoreDeadCode
Log("BrowserIndex.JRDC2OnBrowser")
'convert the payload to json
Dim jsonPayload As String = BANano.ToJson(payload)
Log(jsonPayload)
'push the payload to the server
Dim resp As Object
Dim prom As BANanoPromise = ws.RunFunctionWithResult("JRDC2OnServer", Array(jsonPayload))
prom.Then(resp)
Log(resp)
prom.end
End Sub
Well I'm not sure if its the right way to do it because an jRDC2 call is a ResumableSub. JRDC2OnBrowser calls the JRDC2OnServer call. Whilst the sql commands are executed on the underlying db, the above error is always a result. Perhaps Im doing something wrong and would appreciate any assistance I can get.
B4X:
Sub JRDC2OnServer(payload As String) As ResumableSub
Log("ServerIndex.JRDC2OnServer...")
odbc.Initialize(payload)
odbc.OpenJRDC2
wait for (odbc.ToJRDC2) Complete (Done As Boolean)
Return odbc.payload
End Sub
I have attached the source code and the SQL file for the backend database. There is a jRDC b4j project and some external libraries on the repo link above.
I thank you.
PS: the config.properties files on both projects hold the settings for the projects, the UI is on 55056 and the JRDC2 on 17178 (ports)
Last edited: