Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.9k views
in Technique[技术] by (71.8m points)

请问大家,javaweb中,C/S端不能直连,该如何通信呢?

麻烦大家提提建议。项目是C/S分离的,现在我有这样一种场景:C端可以直接连接S端,而S端由于网络配置原因,无法直接连接C端。在这种情况下,双方该如何进行通信呢?我试过GRPC和WebSocket,由于个人水平原因,感觉都不是很理想。
麻烦大家帮我想想办法,有没有什么更好的通信方案,或者GRPC和WebSocket怎么使用能够更好的满足这种需求。谢谢大家!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

按你的描述,WebSocket应该可以满足的你需求的,达到双方主动通信;不知道你项目有没有使用spring, spring有提供与WebSocket的集成;
https://docs.spring.io/spring...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...