Updated package websocket
This commit is contained in:
parent
e1302d6a6a
commit
197c4034d3
4 changed files with 60 additions and 53 deletions
|
@ -12,8 +12,8 @@
|
||||||
* Upgrade jael_preprocessor to 3.0.0
|
* Upgrade jael_preprocessor to 3.0.0
|
||||||
* Upgrade validate to 3.0.0
|
* Upgrade validate to 3.0.0
|
||||||
* Upgrade json_god to 3.0.0
|
* Upgrade json_god to 3.0.0
|
||||||
|
* Upgrade angel_client to 3.0.0
|
||||||
|
|
||||||
* Upgrade angel_client to 3.0.0 (todo)
|
|
||||||
* Upgrade angel_websocket to 3.0.0 (todo)
|
* Upgrade angel_websocket to 3.0.0 (todo)
|
||||||
* Upgrade test to 3.0.0 (todo)
|
* Upgrade test to 3.0.0 (todo)
|
||||||
* Upgrade angel_jael to 3.0.0 (todo)
|
* Upgrade angel_jael to 3.0.0 (todo)
|
||||||
|
|
|
@ -2,20 +2,36 @@ author: Tobe O <thosakwe@gmail.com>
|
||||||
description: Testing utility library for the Angel framework. Use with package:test.
|
description: Testing utility library for the Angel framework. Use with package:test.
|
||||||
homepage: https://github.com/angel-dart/test.git
|
homepage: https://github.com/angel-dart/test.git
|
||||||
name: angel_test
|
name: angel_test
|
||||||
version: 2.0.1
|
version: 3.0.0
|
||||||
|
publish_to: none
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.10.0 <2.12.0"
|
sdk: ">=2.10.0 <3.0.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_client: # ^2.0.0
|
angel_client:
|
||||||
path: ../client
|
git:
|
||||||
angel_framework: # ^2.0.0-alpha
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
path: ../framework
|
ref: sdk-2.12.x
|
||||||
angel_http_exception: #^1.0.0
|
path: packages/client
|
||||||
path: ../http_exception
|
angel_framework:
|
||||||
angel_validate: # ^2.0.0
|
git:
|
||||||
path: ../validate
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
angel_websocket: # ^2.0.0
|
ref: sdk-2.12.x
|
||||||
path: ../websocket
|
path: packages/framework
|
||||||
|
angel_http_exception:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: sdk-2.12.x
|
||||||
|
path: packages/http_exception
|
||||||
|
angel_validate:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: sdk-2.12.x
|
||||||
|
path: packages/validate
|
||||||
|
angel_websocket:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
ref: sdk-2.12.x
|
||||||
|
path: packages/websocket
|
||||||
http: ^0.12.0
|
http: ^0.12.0
|
||||||
matcher: ^0.12.0
|
matcher: ^0.12.0
|
||||||
mock_request: ^1.0.0
|
mock_request: ^1.0.0
|
||||||
|
|
|
@ -91,8 +91,8 @@ class AngelWebSocket {
|
||||||
this.deserializer,
|
this.deserializer,
|
||||||
this.allowedOrigins,
|
this.allowedOrigins,
|
||||||
this.allowedProtocols}) {
|
this.allowedProtocols}) {
|
||||||
if (serializer == null) serializer = json.encode;
|
serializer ??= json.encode;
|
||||||
if (deserializer == null) deserializer = (params) => params;
|
deserializer ??= (params) => params;
|
||||||
}
|
}
|
||||||
|
|
||||||
HookedServiceEventListener serviceHook(String path) {
|
HookedServiceEventListener serviceHook(String path) {
|
||||||
|
@ -100,15 +100,16 @@ class AngelWebSocket {
|
||||||
if (e.params != null && e.params['broadcast'] == false) return;
|
if (e.params != null && e.params['broadcast'] == false) return;
|
||||||
|
|
||||||
var event = await transformEvent(e);
|
var event = await transformEvent(e);
|
||||||
event.eventName = "$path::${event.eventName}";
|
event.eventName = '$path::${event.eventName}';
|
||||||
|
|
||||||
_filter(WebSocketContext socket) {
|
dynamic _filter(WebSocketContext socket) {
|
||||||
if (e.service.configuration.containsKey('ws:filter'))
|
if (e.service.configuration.containsKey('ws:filter')) {
|
||||||
return e.service.configuration['ws:filter'](e, socket);
|
return e.service.configuration['ws:filter'](e, socket);
|
||||||
else if (e.params != null && e.params.containsKey('ws:filter'))
|
} else if (e.params != null && e.params.containsKey('ws:filter')) {
|
||||||
return e.params['ws:filter'](e, socket);
|
return e.params['ws:filter'](e, socket);
|
||||||
else
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await batchEvent(event, filter: _filter);
|
await batchEvent(event, filter: _filter);
|
||||||
|
@ -236,8 +237,10 @@ class AngelWebSocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Hooks a service up to have its events broadcasted.
|
/// Hooks a service up to have its events broadcasted.
|
||||||
hookupService(Pattern _path, HookedService service) {
|
dynamic hookupService(Pattern _path, HookedService service) {
|
||||||
String path = _path.toString();
|
var path = _path.toString();
|
||||||
|
|
||||||
|
// TODO: Relook at this code
|
||||||
service.after(
|
service.after(
|
||||||
[
|
[
|
||||||
HookedServiceEvent.created,
|
HookedServiceEvent.created,
|
||||||
|
|
|
@ -7,22 +7,16 @@ author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/angel_websocket
|
homepage: https://github.com/angel-dart/angel_websocket
|
||||||
publish_to: none
|
publish_to: none
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_auth: ^3.0.0
|
angel_auth:
|
||||||
angel_client: ^3.0.0
|
git:
|
||||||
angel_framework: ^3.0.0
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
angel_http_exception: ^2.0.0
|
ref: sdk-2.12.x
|
||||||
http: ">=0.11.0 <0.13.0"
|
path: packages/auth
|
||||||
merge_map: ^1.0.0
|
angel_client:
|
||||||
meta: ^1.0.0
|
git:
|
||||||
stream_channel: ^2.0.0
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
web_socket_channel: ^1.0.0
|
ref: sdk-2.12.x
|
||||||
dev_dependencies:
|
path: packages/client
|
||||||
angel_container: ^2.0.0
|
|
||||||
angel_model: ^2.0.0
|
|
||||||
# logging: ^0.11.0
|
|
||||||
pedantic: ^1.0.0
|
|
||||||
test: ^1.15.7
|
|
||||||
dependency_overrides:
|
|
||||||
angel_framework:
|
angel_framework:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
@ -33,6 +27,12 @@ dependency_overrides:
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
ref: sdk-2.12.x
|
ref: sdk-2.12.x
|
||||||
path: packages/http_exception
|
path: packages/http_exception
|
||||||
|
http: ^0.13.0
|
||||||
|
merge_map: ^1.0.0
|
||||||
|
meta: ^1.0.0
|
||||||
|
stream_channel: ^2.0.0
|
||||||
|
web_socket_channel: ^2.0.0
|
||||||
|
dev_dependencies:
|
||||||
angel_container:
|
angel_container:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
|
@ -43,19 +43,7 @@ dependency_overrides:
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
url: https://github.com/dukefirehawk/angel.git
|
||||||
ref: sdk-2.12.x
|
ref: sdk-2.12.x
|
||||||
path: packages/model
|
path: packages/model
|
||||||
angel_route:
|
# logging: ^0.11.0
|
||||||
git:
|
pedantic: ^1.0.0
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
test: ^1.15.7
|
||||||
ref: sdk-2.12.x
|
|
||||||
path: packages/route
|
|
||||||
angel_auth:
|
|
||||||
git:
|
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
|
||||||
ref: sdk-2.12.x
|
|
||||||
path: packages/auth
|
|
||||||
angel_client:
|
|
||||||
git:
|
|
||||||
url: https://github.com/dukefirehawk/angel.git
|
|
||||||
ref: sdk-2.12.x
|
|
||||||
path: packages/angel_client
|
|
||||||
|
|
Loading…
Reference in a new issue