Committed by
GitHub
Merge pull request #902 from eduardoflorence/getsocket-allowselfsigned
Getsocket allowselfsigned
Showing
3 changed files
with
53 additions
and
4 deletions
| @@ -6,5 +6,6 @@ class GetSocket extends BaseWebSocket { | @@ -6,5 +6,6 @@ class GetSocket extends BaseWebSocket { | ||
| 6 | GetSocket( | 6 | GetSocket( |
| 7 | String url, { | 7 | String url, { |
| 8 | Duration ping = const Duration(seconds: 5), | 8 | Duration ping = const Duration(seconds: 5), |
| 9 | - }) : super(url, ping: ping); | 9 | + bool allowSelfSigned = true |
| 10 | + }) : super(url, ping: ping, allowSelfSigned: allowSelfSigned); | ||
| 10 | } | 11 | } |
| @@ -18,9 +18,13 @@ class BaseWebSocket { | @@ -18,9 +18,13 @@ class BaseWebSocket { | ||
| 18 | WebSocket socket; | 18 | WebSocket socket; |
| 19 | SocketNotifier socketNotifier = SocketNotifier(); | 19 | SocketNotifier socketNotifier = SocketNotifier(); |
| 20 | bool isDisposed = false; | 20 | bool isDisposed = false; |
| 21 | - BaseWebSocket(this.url, {this.ping = const Duration(seconds: 5)}); | 21 | + BaseWebSocket( |
| 22 | + this.url, { | ||
| 23 | + this.ping = const Duration(seconds: 5), | ||
| 24 | + this.allowSelfSigned = true, | ||
| 25 | + }); | ||
| 22 | Duration ping; | 26 | Duration ping; |
| 23 | - bool allowSelfSigned = true; | 27 | + bool allowSelfSigned; |
| 24 | 28 | ||
| 25 | ConnectionStatus connectionStatus; | 29 | ConnectionStatus connectionStatus; |
| 26 | 30 |
| 1 | +import './socket_notifier.dart'; | ||
| 2 | + | ||
| 1 | class BaseWebSocket { | 3 | class BaseWebSocket { |
| 2 | String url; | 4 | String url; |
| 3 | Duration ping; | 5 | Duration ping; |
| 4 | - BaseWebSocket(this.url, {this.ping = const Duration(seconds: 5)}) { | 6 | + bool allowSelfSigned; |
| 7 | + BaseWebSocket( | ||
| 8 | + this.url, { | ||
| 9 | + this.ping = const Duration(seconds: 5), | ||
| 10 | + allowSelfSigned = true, | ||
| 11 | + }) { | ||
| 12 | + throw 'To use sockets you need dart:io or dart:html'; | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + Future connect() async { | ||
| 16 | + throw 'To use sockets you need dart:io or dart:html'; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + void onOpen(OpenSocket fn) { | ||
| 20 | + throw 'To use sockets you need dart:io or dart:html'; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + void onClose(CloseSocket fn) { | ||
| 24 | + throw 'To use sockets you need dart:io or dart:html'; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + void onError(CloseSocket fn) { | ||
| 28 | + throw 'To use sockets you need dart:io or dart:html'; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + void onMessage(MessageSocket fn) { | ||
| 32 | + throw 'To use sockets you need dart:io or dart:html'; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + void on(String event, MessageSocket message) { | ||
| 5 | throw 'To use sockets you need dart:io or dart:html'; | 36 | throw 'To use sockets you need dart:io or dart:html'; |
| 6 | } | 37 | } |
| 7 | 38 | ||
| 8 | void close([int status, String reason]) { | 39 | void close([int status, String reason]) { |
| 9 | throw 'To use sockets you need dart:io or dart:html'; | 40 | throw 'To use sockets you need dart:io or dart:html'; |
| 10 | } | 41 | } |
| 42 | + | ||
| 43 | + void send(dynamic data) async { | ||
| 44 | + throw 'To use sockets you need dart:io or dart:html'; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + void dispose() { | ||
| 48 | + throw 'To use sockets you need dart:io or dart:html'; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + void emit(String event, dynamic data) { | ||
| 52 | + throw 'To use sockets you need dart:io or dart:html'; | ||
| 53 | + } | ||
| 54 | + | ||
| 11 | } | 55 | } |
-
Please register or login to post a comment