ocket.IO Client library wrap for this
Am very impressed that you develop this library for us.
but unfortunately, when I run your example , this gave me the following error:
io.socket.engineio.client.EngineIOException: xhr poll error.
I just modify this line of your very code:
[CODE lang="b4x" title="socket io example" highlight="3"]Sub ConnectBtn_Click
socket.initialize("socket")
socket.connect("http://localhost:999","",False)
'socket.connectWithOptions("http://localhost:999","{ rejectUnauthorized: false }", False,True, 0,1000,5000,20000) 'connect with options
StatusLbl.Text = "Connecting"
End Sub[/CODE]
and this is my nodejs server running
[CODE lang="javascript" title="server"]
/*app.get('/', (req, res) => {
res.sendFile(__dirname + '/index.html');
});*/
const app = require('express')();
const http = require('http').createServer(app);
const io = require('socket.io')(http);
io.on('connection', (socket) => {
console.log('a user connected');
});
http.listen(999, () => {
console.log('escuchando en el puerto *:999');
});
io.sockets.on('connection', function(socket){
console.log("User Connected");
socket.on('user_msg', function(data,callback){
io.emit('new_message', data);
callback("Data Received");
});
socket.on('disconnect', function(data){
console.log('User disconnected');
});
});[/CODE]
and this is my manifest
[CODE lang="html" title="manifest"]AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/>
<uses-permission android:name="android.permission.INTERNET" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:usesCleartextTraffic, "true")
CreateResourceFromFile(Macro, Themes.DarkTheme)[/CODE]
could you please help me to figure out whats wrong with my code?
best regards.