feat: complate socket.io base framework

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-03-21 15:47:42 +08:00
parent 15f09abce0
commit 6c9ea9fb74
20 changed files with 1569 additions and 16 deletions

View File

@@ -2,18 +2,19 @@ const TypeParameterMatcher = Java.type('io.netty.util.internal.TypeParameterMatc
const SimpleChannelInboundHandler = Java.type('io.netty.channel.SimpleChannelInboundHandler')
const FullHttpRequestMatcher = TypeParameterMatcher.get(base.getClass('io.netty.handler.codec.http.FullHttpRequest'))
export default abstract class HttpRequestHandlerAdapter {
export abstract class HttpRequestHandlerAdapter {
private _Handler;
constructor() {
this._Handler == Java.extend(SimpleChannelInboundHandler, {
let HttpRequestHandlerAdapterImpl = Java.extend(SimpleChannelInboundHandler, {
acceptInboundMessage: (msg: any) => {
return FullHttpRequestMatcher.match(msg)
},
channelRead0: this.channelRead0
channelRead0: this.channelRead0.bind(this)
})
this._Handler = new HttpRequestHandlerAdapterImpl();
}
abstract channelRead0(ctx: any, msg: any);
abstract channelRead0(ctx: any, request: any);
getHandler() {
return this._Handler;
}
}
}