|
@@ -58,13 +58,11 @@ class JsonRpcNotificationListener {
|
|
|
|
|
|
/// Add notification-handler.
|
|
|
///
|
|
|
- /// [type] The type of message for targeting handlers.
|
|
|
- ///
|
|
|
/// [handler] A notification-handler instance extends class [JsonRpcNotificationHandlerBase].
|
|
|
void addHandler<T extends JsonRpcNotificationHandlerBase>(
|
|
|
- NotificationTypeEnum type,
|
|
|
T handler,
|
|
|
) {
|
|
|
+ final type = handler.type;
|
|
|
if (!_handlersMap.containsKey(type)) {
|
|
|
_handlersMap[type] = {};
|
|
|
}
|
|
@@ -83,8 +81,8 @@ class JsonRpcNotificationListener {
|
|
|
set.removeWhere((e) => e is T);
|
|
|
}
|
|
|
|
|
|
- /// Dispose connection & other resources.
|
|
|
- void dispose() {
|
|
|
+ /// Close and dispose connection/other resources.
|
|
|
+ void close() {
|
|
|
if (channel != null) {
|
|
|
if (channel!.closeCode != null) {
|
|
|
channel!.sink.close(wsStatus.normalClosure);
|