This commit is contained in:
thosakwe 2017-02-12 15:06:54 -05:00
parent fc137dac31
commit cfae7cf99f
5 changed files with 13 additions and 8 deletions

View file

@ -1,5 +1,5 @@
# angel_websocket
[![1.0.0-dev+10](https://img.shields.io/badge/pub-1.0.0--dev+10-red.svg)](https://pub.dartlang.org/packages/angel_websocket)
[![1.0.0](https://img.shields.io/badge/pub-1.0.0-brightgreen.svg)](https://pub.dartlang.org/packages/angel_websocket)
[![build status](https://travis-ci.org/angel-dart/websocket.svg)](https://travis-ci.org/angel-dart/websocket)
WebSocket plugin for Angel.

View file

@ -234,7 +234,7 @@ class BaseWebSocketService extends Service {
}
@override
Future<List> index([Map params]) async {
Future index([Map params]) async {
socket.sink.add(serialize(new WebSocketAction(
eventName: '$path::${ACTION_INDEX}', params: params ?? {})));
return null;

View file

@ -38,13 +38,14 @@ class WebSockets extends BaseWebSocketClient {
WebSocketsService service<T>(String path,
{Type type, AngelDeserializer deserializer}) {
String uri = path.replaceAll(_straySlashes, '');
return new WebSocketsService(socket, this, uri, null);
return new WebSocketsService(socket, this, uri, deserializer: deserializer);
}
}
class WebSocketsService extends BaseWebSocketService {
final Type type;
WebSocketsService(WebSocketChannel socket, Angel app, String uri, this.type)
: super(socket, app, uri);
WebSocketsService(WebSocketChannel socket, Angel app, String uri,
{this.type, AngelDeserializer deserializer})
: super(socket, app, uri, deserializer: deserializer);
}

View file

@ -91,7 +91,7 @@ class AngelWebSocket extends AngelPlugin {
if (result == true) {
var serialized = event.toJson();
_printDebug('Batching this event: $serialized');
print('Serialized: ' + JSON.encode(serialized));
// print('Serialized: ' + JSON.encode(serialized));
client.io.add(god.serialize(event.toJson()));
}
});
@ -117,7 +117,11 @@ class AngelWebSocket extends AngelPlugin {
var params = mergeMap([
god.deserializeDatum(action.params),
{"provider": Providers.WEBSOCKET}
{
"provider": Providers.WEBSOCKET,
'__requestctx': socket.request,
'__responsectx': socket.response
}
]);
try {

View file

@ -2,7 +2,7 @@ name: angel_websocket
description: WebSocket plugin for Angel
environment:
sdk: ">=1.19.0"
version: 1.0.0-dev+10
version: 1.0.0
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/angel_websocket
dependencies: