It is not recommended to use jServer in a UI app
Yes, i was firstly using jServer TOO. In the UI App i am not using jserver at all. Here i am only using the JDA Library and i do react in Events. I get an Message Arrived Event for any Message the Bot got.
More information please...
I am not able to give any congrete Error as of now as i did changed to not use jServer for now. Until i know it should work.
I try to explain:
When using jServer i do initialize jServer in Main Module. Then, for the jServer, additional work is done in any of the defined ServerHandlers.
I do need to run a JDA Instance in the Server-App TOO.
As JDA does not need much but a Databaseconnection i am using ConnectionPool to use DB-Access inside the JDA-Events.
JDA is initialized in Main too. JDA is internally using a WebSocketClient (i dont need to take care about; all is handled by JDA internally.
JDA raises two Events.
Sub JDA_onReady(event As Object)
End Sub
' and
Sub JDA_onMessageReceived(event As Object)
End Sub
I do all the "work" inside (or initiated by the Event) JDA_onMessageReceived.
I also do use a Timer (in Main) to check for unhandled Data to store. It raises every 5 Seconds a Tick and here i do save Data to the Database which are in a "Queue" (a Processglobal List),
While developing i did errors for sure which then raises an Exception. From the Error i see in the Log it looks all as it happens in
Sub AppStart (Args() As String)
End Sub
but the Error is inside some code which runs inside the Message Arrived Event or in the timer Tick Event.
I was thinking that i can not use the JDA in the Server App how i am using it. So i decided to ask here to be sure it should work like this at all.
Coding error are expected and does crash some times, sure.