Comments (6)
FYI: https://github.com/rikulo/socket.io-client-dart#version-info
from socket.io-client-dart.
when i use any v2, the socket server is not detected at all.
from socket.io-client-dart.
To work with socket.io dart client, you have to know which application type you are using, such as Flutter app, Flutter Web app, Pure Dart Client app, or Pure Dart app. Each different type requires a different connecting argument, which you can find in the README.md file in the repo. Even if the connecting arguments are correct, you have to setup the http server config (such as Apache HTTP server or Nginx) to make it work with socket.io connection, such as WebSocket, or pure HTTP connection.
The pure test code can work in the pure Dart app or pure Dart client app, please take a look at Dart client to access NodeJs server and this Flutter example can work too.
from socket.io-client-dart.
what would be the ideal setup if I am using using socket_io_client on flutter app and now shifted to pure dart for server side using socket_io 1.0.1? I am still getting the same error message [ping timeout, null]
.
from socket.io-client-dart.
Dart server doesn't support v2 version and Flutter app (not web) can only work with websocket
transport.
from socket.io-client-dart.
Dart server doesn't support v2 version and Flutter app (not web) can only work with
websocket
transport.
hello sir my socket.on(message not working. import 'package:flutter/material.dart';
import 'package:socket_io_client/socket_io_client.dart' as IO;
class checking extends StatefulWidget {
const checking({Key? key}) : super(key: key);
@OverRide
State createState() => _checkingState();
}
class _checkingState extends State {
late IO.Socket socket;
@OverRide
void initState() {
super.initState();
initSocket();
}
var k = "click";
Future initSocket() async {
socket = IO.io("http://13.126.94.67:1000", <String, dynamic>{
'autoConnect': true,
'transports': ['websocket'],
});
socket.onConnect((_) {
print('Connection established');
// Emit the "connected" event after connecting
socket.emit('connected', {
'livestreamId': "651674a1907e321ab7acb78a",
'coursefieldId': "649eb48d8bfdc575a18c64c6",
});
socket.on('connected', (data) {
print('Response from connected event: ${data["roomId"]}');
socket.emit('joinRoom', {
'roomId': data["roomId"],
});
});
});
socket.onDisconnect((_) => print('Connection Disconnection'));
socket.onConnectError((err) => print(err));
socket.onError((err) => print(err));
// Listen for "message" event
socket.on("message", (data) {
print("Received message: $data");
});
var test =socket;
// Connect to the server
socket.connect();
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () {
print(socket.connected);
// Emit the "message" event here
socket.emit("message", {
"livestreamId": "651674a1907e321ab7acb78a",
"coursefieldId": "649eb48d8bfdc575a18c64c6",
"studentId": "64d4804b4c3c39e38865b041",
"subjectId": "649eb5718bfdc575a18c64da",
"message": "ravi msg emmit",
"roomId": "S_9ShObYjjcePoBGAAGV",
});
print(socket.connected);
},
child: Text("$k"),
),
),
);
}
}
from socket.io-client-dart.
Related Issues (20)
- Library is not compatible with latest version on socket.io 4.7.4 HOT 1
- Is this library maintained? HOT 1
- Not able to access events in the custom rooms HOT 3
- Windows Issues HOT 1
- socket_io_common ?? HOT 1
- Two different socket instances share same "path" event when setPath() is defined HOT 2
- Error Timeout HOT 7
- Error on dispose HOT 4
- Would be great to somehow catch when connection with the server is down.
- Missing Websocket listening events HOT 1
- js version is too high. Many popular libraries depend on 0.6.x. Version is incompatible. HOT 4
- Can this package migrate `js` to `web`? HOT 2
- hot restart error
- Hot Reload Causes Multiple SocketIO Client Instances In Flutter Web
- what does the `autoConnect` property do? please review my flutter code. HOT 2
- WebSocketException: Connection to 'APIURL:0/socket.io/?EIO=4&transport=websocket#' was not upgraded to websocket HOT 3
- Usage proxy
- could we ack when we receive a new event HOT 3
- error with timeout and emitWithAck
- receiving duplicate message
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from socket.io-client-dart.