How to use WebSocket? in the Service layer

the current business has a system similar to "second kill". After clicking the second kill, the user first generates the order, and notifies the front desk after the order is generated. This notification is done using WebSocket. How can I call WebSocket to send a message to the front desk after the order is generated? The order is processed in the Service layer. I don"t want to use foreground polling or background polling. The framework is that SpringBoot, cannot directly inject WebSocket into the Service layer

Sep.16,2021

since the WebSocket notification module can exist independently, you can create a new accessibility class to inject WebSocket, and provide a method to send messages. If you need to use it, you can inject the tool class ~

Menu