Hi, I have a server that listens to 1 Websockets. It was done with .net.
There are many devices connected to this server that can send and receive data.
and when I try it with the postman application, I can still send and receive data.
my problem is this: I can send data with B4A, but I can't get data.
The server sends data to All Devices, but data does not fall into my application.
How do I overcome this problem ?
There are many devices connected to this server that can send and receive data.
and when I try it with the postman application, I can still send and receive data.
my problem is this: I can send data with B4A, but I can't get data.
The server sends data to All Devices, but data does not fall into my application.
How do I overcome this problem ?
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'Private wsh As WebSocketHandler
Private ws As WebSocket
Private link As String = "ws://192.168.1.54:2030/PtsWebServis"
End Sub
Sub Globals
Private btnConnect As Button
Private lblServerTime As Label
Private lblStatus As Label
Private btnSend As Button
Private EditText1 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
' wsh.Initialize(Me,"wsh")
ws.Initialize("wsh")
End If
Activity.LoadLayout("1")
'accept all trust manager
End Sub
Sub btnSend_Click
ws.SendText("Test")
EditText1.RequestFocus
EditText1.SelectAll
End Sub
Sub EditText1_EnterPressed
If btnSend.Enabled Then btnSend_Click
End Sub
Sub wsh_TextMessage (Message As String)
MsgboxAsync(Message,"Message")
End Sub
Sub wsh_Connected
UpdateStatus
End Sub
Sub wsh_Closed (Reason As String)
UpdateStatus
ToastMessageShow(Reason, True)
End Sub
Sub Activity_Resume
UpdateStatus
End Sub
Sub UpdateStatus
If ws.Connected Then
lblStatus.Text = "Status: Connected"
Else
lblStatus.Text = "Status: Disconnected"
End If
btnConnect.Enabled = Not(ws.Connected)
btnSend.Enabled = ws.Connected
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnConnect_Click
ws.Connect(link)
lblStatus.Text = "Status: Connecting..."
End Sub
Last edited: