Skip to content

Commit

Permalink
doc (socketio): fix packet middleware bug (#4204)
Browse files Browse the repository at this point in the history
this.packet is undefined, data in ctx.packet
  • Loading branch information
fuxingZhang committed Mar 20, 2020
1 parent 2fcd605 commit b4b9b50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/source/en/tutorials/socketio.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Acts on each data packet (each message). In the production environment, it is us
module.exports = app => {
return async (ctx, next) => {
ctx.socket.emit('res', 'packet received!');
console.log('packet:', this.packet);
console.log('packet:', ctx.packet);
await next();
};
};
Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/tutorials/socketio.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ module.exports = app => {
module.exports = app => {
return async (ctx, next) => {
ctx.socket.emit('res', 'packet received!');
console.log('packet:', this.packet);
console.log('packet:', ctx.packet);
await next();
};
};
Expand Down

0 comments on commit b4b9b50

Please sign in to comment.