@@ -37,9 +37,9 @@ class Server
3737 private $ icpSocket ;
3838
3939 /**
40- * @var string $ipcSocketPath
40+ * @var null| string $ipcSocketPath
4141 */
42- private string $ ipcSocketPath ;
42+ private ? string $ ipcSocketPath ;
4343
4444 /**
4545 * @var string $ipcOwner If set, owner of the ipc socket will be changed to this value.
@@ -114,12 +114,12 @@ class Server
114114 /**
115115 * @param string $host
116116 * @param int $port
117- * @param string $ipcSocketPath
117+ * @param null| string $ipcSocketPath
118118 */
119119 public function __construct (
120120 string $ host = 'localhost ' ,
121121 int $ port = 8000 ,
122- string $ ipcSocketPath = '/tmp/phpwss.sock '
122+ ? string $ ipcSocketPath = '/tmp/phpwss.sock '
123123 ) {
124124 $ this ->host = $ host ;
125125 $ this ->port = $ port ;
@@ -137,12 +137,13 @@ public function run(): void
137137 {
138138 ob_implicit_flush ();
139139 $ this ->createSocket ($ this ->host , $ this ->port );
140- $ this ->openIPCSocket ($ this ->ipcSocketPath );
140+ if ($ this ->ipcSocketPath )
141+ $ this ->openIPCSocket ($ this ->ipcSocketPath );
141142 $ this ->log ('Server created ' );
142143
143144 while (true ) {
144145 $ this ->timers ->runAll ();
145-
146+
146147 $ changed_sockets = $ this ->allsockets ;
147148 @stream_select ($ changed_sockets , $ write , $ except , 0 , 5000 );
148149 foreach ($ changed_sockets as $ socket ) {
0 commit comments