forked from napengam/phpWebSocketServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestWithPHPSockets.php
More file actions
44 lines (36 loc) · 965 Bytes
/
testWithPHPSockets.php
File metadata and controls
44 lines (36 loc) · 965 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
if ($argc > 1) {
parse_str(implode('&', array_slice($argv, 1)), $_GET);
}
require 'websocketPhp.php';
include '../include/adressPort.inc.php';
$talk = new websocketPhp($Address.'/php');
if (!isset($_GET['m'])) {
$_GET['m'] = '';
}
$message = trim($_GET['m']);
if ($message == '') {
//return;
$message = 'hallo from PHP';
} else {
$talk->broadcast($message);
$talk->silent();
exit;
}
$longString = '';
for ($i = 0; $i < 9 * 1024; $i++) {
$longString .= 'P';
}
/*
* ***********************************************
* test if messages apear in same order as send
* no message is lost and very long message is buffered
* ***********************************************
*/
$talk->broadcast("$message 1");
$talk->broadcast("$message 2");
$talk->broadcast("$message 3");
$talk->broadcast("$message 4");
$talk->broadcast("$message 5");
$talk->broadcast("äüöÄÜÖß$longString 6~6~6~6 ÄÜÖßäüö");
$talk->silent();