yii2-swoole-websocket icon indicating copy to clipboard operation
yii2-swoole-websocket copied to clipboard

To support RESTful

Open curtis18 opened this issue 6 years ago • 4 comments

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

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

curtis18 avatar Jul 12 '19 09:07 curtis18

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

immusen avatar Jul 12 '19 09:07 immusen

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. ^_^

curtis18 avatar Jul 12 '19 12:07 curtis18

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

immusen avatar Jul 14 '19 16:07 immusen

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.

curtis18 avatar Jul 15 '19 08:07 curtis18