简体   繁体   English

非常规地将Web套接字服务器与REST API捆绑在一起?

[英]Unconventional to bundle web socket server with REST API?

For an enterprise REST API (PHP in this case), is it a bad practice to include a web socket server along with a REST API? 对于企业REST API(在这种情况下为PHP),将Web套接字服务器与REST API一起包含是一种不好的做法吗? The pairing of the two makes a nice mix with event dispatching services, but I'm not sure if these two services are different enough where they warrant separation? 两者的配对与事件分发服务很好地结合在一起,但是我不确定这两个服务在需要分开的地方是否足够不同? I guess the only con I can see at the moment, would be that if the REST API were to go down, then your web socket servers are also down, which removes the possibility of having fail-over for any connected clients, or something to that degree. 我想目前我唯一能看到的缺点是,如果REST API掉线,那么您的Web套接字服务器也会掉线,这消除了对任何已连接客户端进行故障转移的可能性,或者这个程度。

If you're looking for a really robust way to manage web sockets, check out http://faye.jcoglan.com/ - it has libraries for JavaScript, Ruby, etc, and runs independently of your other servers. 如果您正在寻找一种管理Web套接字的可靠方法,请访问http://faye.jcoglan.com/-它具有JavaScript,Ruby等库,并且独立于其他服务器运行。

If you don't need that kind of resilience, then I wouldn't worry about mixing your REST and web socket APIs on the same server. 如果您不需要那种弹性,那么我不必担心在同一服务器上混合使用REST和Web套接字API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM