-
Notifications
You must be signed in to change notification settings - Fork 577
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: egg socket io missing session middleware (#835)
- Loading branch information
1 parent
21c78c2
commit 6e605a1
Showing
11 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/web/test/fixtures/issue/base-app-socketio/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "ali-demo" | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/web/test/fixtures/issue/base-app-socketio/src/config/config.default.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg'; | ||
|
||
export type DefaultConfig = PowerPartial<EggAppConfig>; | ||
|
||
export default (appInfo: EggAppInfo) => { | ||
const config = {} as DefaultConfig; | ||
|
||
// use for cookie sign key, should change to your own and keep security | ||
config.keys = appInfo.name + '_1611657289809_5801'; | ||
|
||
// add your config here | ||
config.middleware = []; | ||
|
||
// socket.io配置 | ||
config.io = { | ||
init: {}, // passed to engine.io | ||
namespace: { | ||
'/ws': { | ||
connectionMiddleware: [], | ||
packetMiddleware: [], | ||
}, | ||
}, | ||
}; | ||
|
||
return config; | ||
}; |
Empty file.
12 changes: 12 additions & 0 deletions
12
packages/web/test/fixtures/issue/base-app-socketio/src/config/plugin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { EggPlugin } from 'egg'; | ||
|
||
// 启用socketio | ||
const io = { | ||
enable: true, | ||
package: 'egg-socket.io', | ||
}; | ||
|
||
export default { | ||
static: false, // default is true | ||
io, | ||
} as EggPlugin; |
5 changes: 5 additions & 0 deletions
5
packages/web/test/fixtures/issue/base-app-socketio/src/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Configuration } from '@midwayjs/decorator'; | ||
|
||
@Configuration() | ||
export class ContainerConfiguration { | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/web/test/fixtures/issue/base-app-socketio/src/controller/home.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Controller, Get, Provide } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
@Controller('/') | ||
export class HomeController { | ||
@Get('/') | ||
async home() { | ||
return 'Hello Midwayjs!'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters