@@ -63,13 +63,13 @@ $server->registerApplication('chat', \Bloatless\WebSocket\Examples\Application\C
6363$server->run();
6464```
6565
66- Assuming this code is in a file called ` server.php ` you can than start your server with the following command:
66+ Assuming this code is in a file called ` server.php ` you can then start your server with the following command:
6767
6868``` shell
6969php server.php
7070```
7171
72- The websocket server will than listen for new connection on the provided host and port. By default, this will be
72+ The websocket server will then listen for new connections on the provided host and port. By default, this will be
7373` localhost:8000 ` .
7474
7575This repositoy also includes a working example in [ examples/server.php] ( examples/server.php )
@@ -94,15 +94,15 @@ interface ApplicationInterface
9494}
9595```
9696
97- ` onConnet ` and ` onDisconnect ` can be used to keep track of all the clients connected to your application. ` onData ` will
98- be called whenever the websocket server receives new data from one of the clients connect to the application.
97+ ` onConnect ` and ` onDisconnect ` can be used to keep track of all the clients connected to your application. ` onData ` will
98+ be called whenever the websocket server receives new data from one of the clients connected to the application.
9999` onIPCData ` will be called if data is provided by another process on your machine. (See [ Push-Client (IPC)] ( #push-client-ipc ) )
100100
101101A working example of an application can be found in [ examples/Application/Chat.php] ( examples/Application/Chat.php )
102102
103103### Timers
104104
105- A common requirement to long-running processes such as a websocket server is to execute tasks periodically. This can
105+ A common requirement for long-running processes such as a websocket server is to execute tasks periodically. This can
106106be done using timers. Timers can execute methods within your server or application periodically. Here is an example:
107107
108108``` php
@@ -119,12 +119,12 @@ This example would call the method `someMethod` within your chat application eve
119119### Push-Client (IPC)
120120
121121It is often required to push data into the websocket-server process from another application. Let's assume you run a
122- website containg a chat and an area containing news or a blog. Now every time a new article is published in your blog
122+ website containing a chat and an area containing news or a blog. Now every time a new article is published in your blog
123123you want to notify all users currently in your chat. To achieve this you somehow need to push data from your blog
124124logic into the websocket server. This is where the Push-Client comes into play.
125125
126126When starting the websocket server, it opens a unix-domain-socket and listens for new messages. The Push-Client can
127- than be used to send these messages. Here is an example:
127+ then be used to send these messages. Here is an example:
128128
129129``` php
130130$pushClient = new \Bloatless\WebSocket\PushClient('//tmp/phpwss.sock');
@@ -134,17 +134,16 @@ $pushClient->sendToApplication('chat', [
134134]);
135135```
136136
137- This code pushes data into your running websocket-server process. In this case the ` echo ` Method within the
138- chat-application is called and sends the provided message to all connected clients.
137+ This code pushes data into your running websocket-server process. In this case the ` echo ` method within the
138+ chat-application is called and it sends the provided message to all connected clients.
139139
140140You can find the full working example in: [ examples/push.php] ( examples/push.php )
141141
142- ** Important Hint:** Push messages can be not larger than 64kb!
142+ ** Important Hint:** Push messages cannot be larger than 64kb!
143143
144144### Client (Browser/JS)
145145
146- Everything above this point was related to the server-side of things. But how to connect to the server from your
147- browser?
146+ Everything above this point was related to the server-side of things. But how to connect to the server from your browser?
148147
149148Here is a simple example:
150149
@@ -168,8 +167,8 @@ A better example of the chat client can be found in: [examples/public/chat.html]
168167
169168## Intended use and limitations
170169
171- This project was mainly build for educational purposes. The code is relatively simple and easy to understand. This
172- server was ** not tested in production** , so I strongly recommand to not use it on a live project. It should be totally
170+ This project was mainly built for educational purposes. The code is relatively simple and easy to understand. This
171+ server was ** not tested in production** , so I strongly recommend not to use it in a live project. It should be totally
173172fine for small educational projects or internal tools, but most probably will not handle huge amounts of traffic or
174173connections very well.
175174
0 commit comments