socket.io-client-dart icon indicating copy to clipboard operation
socket.io-client-dart copied to clipboard

Question about Web and Arrays

Open YohanWadia opened this issue 4 years ago • 1 comments

  1. I just wanted to confirm that besides the Server... the dart client code will run in Chrome via Flutters beta version, right?

AND...

  1. In the Js version... I could receive an Array(of integers) too. Can i do that here too? or is the data in socket.on('event', (data) => print(data)); only suppose to be Json or String???

YohanWadia avatar Feb 01 '21 19:02 YohanWadia

  1. Do you mean Flutter Web? Yes, this library should work in either Flutter or Flutter Web, as long as you specify a correct transports to connect.
  2. Sure, it should work with a list of integers, not JS's arguments array. For example,
//Nodejs
socket.emit('event', [1,2,3,4,5,6,7]);

//Dart client
socket.on('event', (data) {
   print(data); // [1,2,3,4,5,6,7]
});

jumperchen avatar Feb 08 '21 03:02 jumperchen