reactphp / socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP.
https://reactphp.org/socket/
MIT License
1.21k stars 157 forks source link

How to handle socket connection on Server #287

Closed ChintanStratAero closed 2 years ago

ChintanStratAero commented 2 years ago

I am building Socket TCP Server for laravel . I want to keep all the connections alive till i don't do connection->close(). But when i do connectionWrite->write ("Hello world") the message is depicted on client screen but connection is also closed. I don't want the connection to die. I want to reuse the connection in future transaction with server. I don't want to close the connection as it does on its own. I am using Postman like Nightingale for testing( as a client). Question on socket

SimonFrings commented 2 years ago

Hey @ChintanStratAero, thanks for bringing this up πŸ‘

It looks like what you're seeing is normal HTTP behavior. After the client requests something and the server responds there's no need for the client to leave the connection open. After receiving its answer the client may close the connection.

If you're using postman for testing purposes you're most likely speaking HTTP. You can take a look at https://github.com/reactphp/http, this may help!

clue commented 2 years ago

I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can always reopen this :+1:

ChintanStratAero commented 2 years ago

Yes sure thanks once again.

On Fri, 18 Mar, 2022, 1:20 AM Christian LΓΌck, @.***> wrote:

I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can always reopen this πŸ‘

β€” Reply to this email directly, view it on GitHub https://github.com/reactphp/socket/issues/287#issuecomment-1071301190, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFMBVZXHIS7PZ5PPWFLHLHLVAOEGTANCNFSM5QY23RMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

ChintanStratAero commented 2 years ago

Simon, Thank you your response helped me. I created client in php which is connected for ever and it working. Thanks one more time..

On Thu, 17 Mar, 2022, 4:31 PM Simon Frings, @.***> wrote:

Hey @ChintanStratAero https://github.com/ChintanStratAero, thanks for bringing this up πŸ‘

It looks like what you're seeing is normal HTTP behavior. After the client requests something and the server responds there's no need for the client to leave the connection open. After receiving its answer the client may close the connection.

If you're using postman for testing purposes you're most likely speaking HTTP. You can take a look at https://github.com/reactphp/http, this may help!

β€” Reply to this email directly, view it on GitHub https://github.com/reactphp/socket/issues/287#issuecomment-1070792161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFMBVZSUDX5WKOWSCVVZ3CLVAMGG5ANCNFSM5QY23RMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>