-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into main
- Loading branch information
Showing
48 changed files
with
1,309 additions
and
212 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { SocketGateway } from './socket.Gateway'; | ||
|
||
@Module({ | ||
providers: [SocketGateway], | ||
}) | ||
export class GatewayModule {} |
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,34 @@ | ||
import { | ||
MessageBody, | ||
SubscribeMessage, | ||
WebSocketGateway, | ||
WebSocketServer, | ||
} from '@nestjs/websockets'; | ||
import { Server } from 'socket.io'; | ||
import { OnModuleInit } from '@nestjs/common'; | ||
|
||
@WebSocketGateway({ | ||
cors: { | ||
origin: ['http://localhost:5173'], | ||
}, | ||
}) | ||
export class SocketGateway implements OnModuleInit { | ||
@WebSocketServer() | ||
server: Server; | ||
|
||
onModuleInit(): any { | ||
this.server.on('connection', (socket) => { | ||
console.log(socket.id); | ||
console.log('Connected'); | ||
}); | ||
} | ||
|
||
@SubscribeMessage('message') | ||
onNewMessage(@MessageBody() body: any) { | ||
console.log(body); | ||
this.server.emit('onMessage', { | ||
msg: 'new Message', | ||
content: body, | ||
}); | ||
} | ||
} |
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,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { SocketGateway } from './socket.Gateway'; | ||
|
||
describe('GatewayGateway', () => { | ||
let gateway: SocketGateway; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [SocketGateway], | ||
}).compile(); | ||
|
||
gateway = module.get<SocketGateway>(SocketGateway); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(gateway).toBeDefined(); | ||
}); | ||
}); |
Oops, something went wrong.
b7d5d10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deployment failed with the following error:
Learn More: https://vercel.link/mix-routing-props