NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: de la Rosa on July 17, 2019, 01:00:09 AM
-
Hi Bruce,
How do I specify a "channel:name" in the host variable to display in a NetWebform for websocket derived variable?
Thanks,
Vic
-
Hi Vic,
A lot for information necessary before that question begins to make sense...
cheers
Bruce
-
Hi Bruce,
In the webserver websocket example you demonstrated how to display a host variable “live”, however all users get the same value. What I need to display “live” is incoming messages specific only for the Logged-in user of the webform which as I understood it I can segregate thru channel and group combination, but how do I specify that channel/group combination in the field to display on the form? The group part should be associated with the current user/session of the webform to make it unique to the user, right? such as using the user.session ID as group perhaps?
In addition, will it be “live” only when the value is updated from a ProcessWebSocketCommand event or can I call a setValue procedure to change the channel:group value from say a WebServer page_received and still have it update “live”?
Thanks,
Vic
-
Hi Bruce,
Am I correct in thinking that to "live" update a watched session value display field on a WebForm, from ProcessWebSocketCommand embed point, I need to access the SessionDataQueue directly via p_web.RequestData.Webserver? I'm not referring to Websocket communications between the WebForm and the WebServer but from another independent WebSocket Client coming in on an independent thread.
Thanks,
Vic
Thanks,
Vic
-
Hello Vic,
Are your clients desktop apps or is this all in a web application?
I currently have a desktop app that watches a host value via websocket. I send and receive a JSON string using websockets. That JSON string, when received, goes into a group. I then validate the data received to determine if that "message" from the websocket is intended for that one app or for all apps watching the host value. Each app is assigned a DeviceId and that is used in the validation. This is in the ReceiveHostValue embed on the client side. I actually don't do anything in the server itself.
NetSocket.ReceiveHostValue PROCEDURE(String p_HostValueName,String p_Value)
! [Priority 5000]
json JSONClass
CODE
! [Priority 2500]
! Parent Call
PARENT.ReceiveHostValue(p_HostValueName,p_Value)
! [Priority 7500]
local.SendDebugString('Host Value Received')
local.SendDebugString(clip(p_value))
st.SetValue(p_value)
Case clip(p_HostValueName)
of 'devicecommands'
json.Start()
json.TagCase = jf:CaseLower !jF:CaseAsIs
json.RemovePrefix = true
if json.Load(devicecommands, st,'devicecommands') = jf:OK
If clip(devicecommands.command) <> ''
if Upper(clip(devicecommands.command)) = 'UPDATE'
local.SendUdp('Update Command Received ',2000)
gps:laststatus = 'Updating'
local.SetSocketValues()
mystate = mystate:CheckingInternet
Elsif Upper(clip(devicecommands.command)) = 'RESTART'
local.SendUdp('Restart Command Received ',2000)
mystate = ''
ThisWindow{PROP:Timer} = 0
gps:laststatus = 'Restarting'
local.SetSocketValues()
gSelfService.RestartService()
Elsif Upper(clip(devicecommands.command)) = 'RESETGPS'
gps:laststatus = 'Resetting GPS'
local.SetSocketValues()
local.ColdStartGPS()
end
End
End
End
Maybe that helps.
Don
-
Hi Don,
Thanks for the response. It's all good and straight forward on a desktop app as you can direct to specific clients. However, on a webForm, it's common to all users and so the only way I know is to have it on a session value and indeed the template setting has a choice of using a sessionvalue and updating live via websocket but then how would the webhandler's ProcessWebsocketCommand know which session's sessionvalue to update when the WebSocket is not tied to any session? So I'm thinking of updating the sessionvalue directly thru the sessiondataQueue and just wondering whether that's enough or do I still need to do p_web.PushSessionValue() after for it to update "live" on the WebForm?
Thanks,
Vic