POST http://xxx.xx.xx.xxx:xxxx HTTP/1.1
content-length: 85
accept-language: fr
host: xxx.xx.xx.xxx:xxxxx
content-type: application/json
accept-encoding: gzip,deflate
accept-charset: UTF-8;q=0.9,*;q=0.7
user-agent: SIGFOX
{
"device":"(redacted)",
"seqNumber":"(redacted)",
"data":"(redacted)"
}
Just make sure your handler class name starts with SERVER.
Just make sure your handler class name starts with SERVER.
In fact, it will work without the SERVER prefix, but I strongly advice to use it as when your project grows bigger, it will help you a lot in identifying which part does what exactly. And it helps a lot for debugging and posting questions if you use it too.I think this what I wanted to have green lights about when doing this with the BANanoServer
Yes. There are cases where the BANano transpiler would not pick up it needs to convert it without them.Is this right
Of course it is. Again BANanoServer = jServer.I started learning about the BANanoServer is because I believe its capable to do all this
Private mSrvr As Server
Public server As ServerSocket
Private client As Socket
'listen for connections
server.listen
'for for a connection to be made
Wait For server_NewConnection (Successful As Boolean, NewSocket As Socket)
Log("New Connection...")
If Successful Then
If astream.IsInitialized Then
astream.Close
End If
client = NewSocket
astream.Initialize(client.InputStream, Null, "astream")
End If
Different ports I'm sure, but I'm not certain this design is the best. I would then probably just leave them as separate apps.ServerSocket within a jServer app running different ports / same ports?
If I take this option, by default, jServer is already listening to whatever port its running from. I just need to get the payload. Ok,I would get rid of the jNetwork and just make a jServer Hander to do the same thing.
Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
Log("Connected")
ws = WebSocket1
' Lets update the cache with this class
CacheReport = Main.Server.UpdateFromCache(Me, ws)
Log("PageID: " & CacheReport.BANPageID)
Log("Comes From Cache:" & CacheReport.ComesFromCache)
Log("Is a reconnecting socket: " & CacheReport.IsReconnected)
Main.server.SendConnected(ws)
End Sub
Server.AddHandler("/myhandler", "SERVERHandler", False)
Not at all. Damn, this has finally caught up with me. I've been procrastinating learning the jServer, jNetworks stuff like forever. Let me refer to ABM and see.You didn't use that in the time you worked with ABM?
You will be happy if you do later. This is the template we start with, but this can grow fast en become a real puzzle if we wouldn't use it.So I should not forget to prefix it with SERVER
And my heart just started beating faster, LOL. Phew, I need to calm down.You will be happy if you do later.
Public Sub Initialize
Log("SigFox initialized....")
SHAREDUtility.Initialize
End Sub
Sub RequestData(ins As InputStream) As Map
Dim data As Map = CreateMap()
Try
Dim tr As TextReader
tr.Initialize(ins)
Dim json As JSONParser
json.Initialize(tr.ReadAll)
data = json.NextObject
Catch
LogDebug("[User/RequestData] " & LastException)
End Try
Return data
End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
mreq = req
mresp = resp
'get the payload
Dim payload As Map = RequestData(req.InputStream)
Log("New Payload...")
Log(payload)
SHAREDUtility.ReturnJSON(payload, resp)
End Sub