koatty_core
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -5,2 +5,4 @@ # Changelog | ||
### [1.6.3](https://github.com/koatty/koatty_core/compare/v1.6.2...v1.6.3) (2022-03-11) | ||
### [1.6.2](https://github.com/koatty/koatty_core/compare/v1.6.2-0...v1.6.2) (2022-03-11) | ||
@@ -7,0 +9,0 @@ |
/*! | ||
* @Author: richen | ||
* @Date: 2022-03-11 11:22:51 | ||
* @Date: 2022-03-11 18:22:00 | ||
* @License: BSD (3-Clause) | ||
@@ -12,2 +12,3 @@ * @Copyright (c) - <richenlin(at)gmail.com> | ||
import { Context } from 'koatty_container'; | ||
import { IncomingMessage } from 'http'; | ||
import Koa from 'koa'; | ||
@@ -66,4 +67,6 @@ import { Metadata } from '@grpc/grpc-js'; | ||
declare type KoaContext = Koa.BaseContext & Koa.DefaultContext; | ||
export declare type IWebSocket = WebSocket; | ||
export declare type KoaContext = Koa.BaseContext & Koa.DefaultContext; | ||
/** | ||
@@ -235,3 +238,3 @@ * Application | ||
*/ | ||
websocket?: WebSocket; | ||
websocket?: IWebSocket; | ||
/** | ||
@@ -366,2 +369,12 @@ * send metadata to http request header. | ||
/** | ||
* WsRequest | ||
* | ||
* @class WsRequest | ||
* @extends {IncomingMessage} | ||
*/ | ||
export declare class WsRequest extends IncomingMessage { | ||
data: Buffer | ArrayBuffer | Buffer[]; | ||
} | ||
export { } |
/*! | ||
* @Author: richen | ||
* @Date: 2022-03-11 11:22:35 | ||
* @Date: 2022-03-11 18:21:44 | ||
* @License: BSD (3-Clause) | ||
@@ -159,2 +159,9 @@ * @Copyright (c) - <richenlin(at)gmail.com> | ||
/* | ||
* @Description: | ||
* @Usage: | ||
* @Author: richen | ||
* @Date: 2021-07-09 11:34:49 | ||
* @LastEditTime: 2022-03-11 18:18:22 | ||
*/ | ||
/** | ||
@@ -224,10 +231,11 @@ * Create KoattyContext | ||
* @param {KoattyContext} ctx | ||
* @param {(Buffer | ArrayBuffer | Buffer[])} data | ||
* @param {IncomingMessage} req | ||
* @param {WebSocket} socket | ||
* @returns {*} {KoattyContext} | ||
*/ | ||
function createWsContext(context, data, socket) { | ||
function createWsContext(context, req, socket) { | ||
var _a; | ||
context.status = 200; | ||
koatty_lib.Helper.define(context, "websocket", socket); | ||
context.setMetaData("_body", data.toString()); | ||
context.setMetaData("_body", ((_a = req.data) !== null && _a !== void 0 ? _a : "").toString()); | ||
return context; | ||
@@ -577,4 +585,14 @@ } | ||
/** | ||
* WsRequest | ||
* | ||
* @class WsRequest | ||
* @extends {IncomingMessage} | ||
*/ | ||
class WsRequest extends http.IncomingMessage { | ||
} | ||
exports.CreateContext = CreateContext; | ||
exports.Koatty = Koatty; | ||
exports.KoattyMetadata = KoattyMetadata; | ||
exports.WsRequest = WsRequest; |
{ | ||
"name": "koatty_core", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "Koatty framework core", | ||
@@ -5,0 +5,0 @@ "scripts": { |
{ | ||
"name": "koatty_core", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "Koatty framework core", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
55741
1518