go-zero
go-zero copied to clipboard
Can I create WS service in rpc?
需求:我需要在rpc的服务里面创建ws的服务,因为我需要在其他的服务里面进行消息的发送,通过grpc进行发送ws的消息
现有的是api有ws的服务
I don't think it's a good practice to do that.
Use WS in api services.
我认为这样做不是一个好习惯。
在 api 服务中使用 WS。
但是我需要后台的其他的服务,推送ws的消息的时候怎么处理呢?
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
I don't think this is a good practice.
Use WS in the api service.
But I need other services in the background, what should I do when I push ws messages?
I think a reasonable route:
client
-> api(ws)
-> rpc
我认为合理的路线:
client
->api(ws)
->rpc
业务的逻辑需要的线路是: rpc -> ws 其他的服务发送任务的时候需要进行同步推送ws的消息
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
I think a reasonable route:
client
->api(ws)
->rpc
The line required by the business logic is: rpc -> ws When other services send tasks, they need to push ws messages synchronously
It's nothing to do with RPC. You just need to send messages to the clients through WS.
In spite of RPC or HTTP services, you need to know the WS connections where to send the messages.
Also, in case of single direct push notification, use MQ instead.
why not use rpc stream instead of it?
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.