Hi All
I am trying to develop a jserver app that will accept web socket connections. My understanding is that jserver is HTTP based. I do not what to use the HTTP aspect of this as I want to send and received data from the clients in a raw format as this is not a web app with HTMl pages etc.
Why do I want to do this ? Most of the apps we have are VB6 winsock base apps. So, we need to use the multi-threading aspect of jserver to provide a more robust solution for our customers and not be limited to running all socket connects on the main thread.
I have very little experience with HTTP servers etc so please forgive my ignorance on this topic.
This is the jserver setup
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The /ws is an empty folder on the root drive (windows 7).
This is the class_websocket
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Using a Vb6 winsock test app or HyperTerminal I can connect to the server but the class_socket does not seem to get executed.
Once I have a connection established I would like know to to send and receive data on each web-socket thread.
I would be very grateful with any assistance on this topic. Once I have this solved I would be quite happy to publish a basic template project to help others who want to achieve the same.
Regards
John.
			
			I am trying to develop a jserver app that will accept web socket connections. My understanding is that jserver is HTTP based. I do not what to use the HTTP aspect of this as I want to send and received data from the clients in a raw format as this is not a web app with HTMl pages etc.
Why do I want to do this ? Most of the apps we have are VB6 winsock base apps. So, we need to use the multi-threading aspect of jserver to provide a more robust solution for our customers and not be limited to running all socket connects on the main thread.
I have very little experience with HTTP servers etc so please forgive my ignorance on this topic.
This is the jserver setup
			
				B4X:
			
		
		
		Sub initialise_host
   CallSubDelayed2(mod_app_functions,"writelog","initialise_host(), not Initialized")
   
   ' // initialise the server host
   Try
     svrHost.Initialize("host")
     svrHost.Port = appSet.svr.port
     svrHost.StaticFilesFolder = appSet.settingsLocation
     ' // root folder
     svrHost.AddWebSocket("/ws","class_websocket")
     svrHost.Start
     appSet.svr.started = True
     CallSubDelayed2(mod_app_functions,"writelog","initialise_host(), server started")
   Catch
     appSet.svr.started = False
     CallSubDelayed2(mod_app_functions,"writelog","initialise_host(), error - " & LastException.Message )
   End Try
End SubThe /ws is an empty folder on the root drive (windows 7).
This is the class_websocket
			
				B4X:
			
		
		
		'WebSocket class
Sub Class_Globals
   
   Private ws As WebSocket
   
End Sub
Public Sub Initialize
   
   CallSubDelayed2(mod_app_functions,"writelog","WebSocket_Initialized()")
   
End Sub
Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
   ws = WebSocket1
   
   CallSubDelayed2(mod_app_functions,"writelog","WebSocket_Connected()")
End Sub
Private Sub WebSocket_Disconnected
   CallSubDelayed2(mod_app_functions,"writelog","WebSocket_Disconnected()")
End SubUsing a Vb6 winsock test app or HyperTerminal I can connect to the server but the class_socket does not seem to get executed.
Once I have a connection established I would like know to to send and receive data on each web-socket thread.
I would be very grateful with any assistance on this topic. Once I have this solved I would be quite happy to publish a basic template project to help others who want to achieve the same.
Regards
John.
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		