immusen / yii2-swoole-websocket

yii2-extension for websocket base on swoole, Support JSONRPC called from websocket client or http client or redis publish to do async task or realtime connect.
Apache License 2.0
32 stars 12 forks source link

To support RESTful #5

Open curtis18 opened 5 years ago

curtis18 commented 5 years ago

Is it possible to add a feature for supporting RESTful? Thank you.

https://www.yiiframework.com/doc/api/2.0/yii-rest-urlrule

immusen commented 5 years ago

Yes, Good idea, I used to have a idea that make this server as a proxy to accept http request for all Yii Web application, I will try to do some test for this feature. And if you have good suggestions, let me know, or join to develop..😄

If success, It will support Upgrade header to switching protocols from HTTP to websocket, e.g. Authorize in HTTP and switch to websocket if necessary... https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism https://stackoverflow.com/questions/26401893/who-is-sending-http-websocket-upgrade-requests

curtis18 commented 5 years ago

It is an good idea, but why not using Nginx or OpenResty as a proxy because I have tested that Swoole does not have good performance at HTTPS connection and is lacking of Regx routing support. Therefore, I am using Nginx as HTTPS proxy and I hope Yii3 can support Swoole natively with coroutine and db pool.

Sure, I can help develop if I can help. ^_^

immusen commented 5 years ago

Just for PHP-FPM, Nginx still works at downstram...

curtis18 commented 5 years ago

Understand. Also, I found that the CPU usage is very high when running the sample codes. I am still figuring it out. The environment I am using is Swoole 4.4 and PHP 7.2 in a docker container.