fennec_socket_io_server 0.0.2 copy "fennec_socket_io_server: ^0.0.2" to clipboard
fennec_socket_io_server: ^0.0.2 copied to clipboard

this plugin belongs to Fennec Framework. it can be used to implement a performant realtime connection from server side.

fennec_socket_io_server is dart plugin to implement SOCKET IO for the server side. it belongs to fennec framework pub.dev but it can be used separately.

Installation #

install the plugin from pub.dev

Example with own HTTP Server. #

ServerIO serverIO1 = ServerIO();
serverIO1.on('connection', (client) {
print('connection');
serverIO1.emit('fromServer', 'ok');
});

await serverIO1.listen('0.0.0.0', 3000);

Example with Fennec HTTP Server. #

 Application application = Application();
 ServerIO serverIO = ServerIO();
 application.setPort(8000).setHost(InternetAddress.loopbackIPv4);
 application.get(
     path: '/dynamic_routes/@userId',
     requestHandler: (req, res) {
       serverIO.emit('fromServer', DateTime.now().toIso8601String());
       res.json({'userId': req.pathParams['userId']});
     },
     middlewares: []);

 Router testRouter = Router(routerPath: '/v1/api');
 testRouter.get(
     path: '/simple', requestHandler: TestController().test, middlewares: []);
 testRouter.get(
   path: '/simple1',
   requestHandler: (Request req, Response res) {
     serverIO.emit('message', 'hello fennec');
     res.send('ss');
   },
 );

 application.useSocketIOServer(true);

 Server server = Server(application);
 await server.startServer();

 serverIO.on('connection', (client) {
   print('coo');
 });

 await serverIO.listenToHttpServer(server.httpServerStream);

License #

MIT

12
likes
0
pub points
21%
popularity

Publisher

verified publisherfennecframework.com

this plugin belongs to Fennec Framework. it can be used to implement a performant realtime connection from server side.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

fennec, js, uuid

More

Packages that depend on fennec_socket_io_server