scvnc / flutter-action-ws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ws_action

A new Flutter package project.

Example

// get the cookie needed to connect to websocket
var c = await requestUrlencoded('https://$domain/auth/gateway/login', 'some-iser', 'somepw');
WsConnectionService.url = 'wss://$domain/ws/';
WsConnectionService.tokenCookie = c;
var wsCon = new WsConnectionService();

// observe the connection status
Observable<WsConnectionStatus> obs = wsCon.statusObs();
obs.forEach((WsConnectionStatus c) {
  print("-- WsConnectionStatus: $c");
});

try {
  dynamic r = await wsCon.actionFut('ListClients', {'arg1': 1});
  print("FUTURE IS DONE!! $r");
} catch (e) {
  // ActionResponseException or Exception
  print("horrors $e");
}

About

License:Other


Languages

Language:Dart 99.6%Language:Shell 0.4%