FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-websocket/server/server.php at master · xhat/php-websocket · GitHub
xhat
php-websocket
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
php-websocket
/
server
/
server.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (22 loc) · 1.06 KB
Breadcrumbs
php-websocket
/
server
/
server.php
Copy path
File metadata and controls
29 lines (22 loc) · 1.06 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details. */
ini_set
(
'
display_errors
'
,
1
);
error_reporting
(
E_ALL
);
require
(
__DIR__
.
'
/lib/SplClassLoader.php
'
);
$
classLoader
=
new
SplClassLoader
(
'
WebSocket
'
,
__DIR__
.
'
/lib
'
);
$
classLoader
->
register
();
$
server
=
new
\
WebSocket
\
Server
(
'
127.0.0.1
'
,
8000
,
false
);
// server settings:
$
server
->
setMaxClients
(
100
);
$
server
->
setCheckOrigin
(
true
);
$
server
->
setAllowedOrigin
(
'
foo.lh
'
);
$
server
->
setMaxConnectionsPerIp
(
100
);
$
server
->
setMaxRequestsPerMinute
(
2000
);
// Hint: Status application should not be removed as it displays usefull server informations:
$
server
->
registerApplication
(
'
status
'
, \
WebSocket
\
Application
\StatusApplication::
getInstance
());
$
server
->
registerApplication
(
'
demo
'
, \
WebSocket
\
Application
\DemoApplication::
getInstance
());
$
server
->
run
();
Back
|
FazBrowse Home
|
New Git URL