Skip to content

Commit

Permalink
add src/SocketEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
贠王军 committed Oct 26, 2018
1 parent 088341a commit 6b56317
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
21 changes: 21 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "yunwangjun/talkart_socket",
"description": "use workman design a socket service",
"require": {
"workerman/gateway-worker": ">=3.0.0",
"workerman/mysql": "^1.0"
},
"license": "MIT",
"authors": [
{
"name": "贠王军",
"email": "[email protected]"
}
],
"require": {},
"autoload": {
"psr-4": {
"TalkArtSocket\\": "src/"
}
}
}
39 changes: 39 additions & 0 deletions src/SocketEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* This file is part of talkart_socket.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author 贠王军<[email protected]>
* @copyright 贠王军<[email protected]>
* @link http://www.yunwangjun.cn/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/

namespace TalkArtSocket;
/**
* Autoload.
*/
class SocketEvent{

public static function publush(){

echo date();
}

public static function notice($subject, $event, $data, $exclude){

foreach ($subject_connnection_map[$subject] as $connection) {
if ($exclude == $connection) {
continue;
}
$connection->send(json_encode(array(
'cmd' => 'publish',
'event' => $event,
'data' => $data
)));
}
}
}

0 comments on commit 6b56317

Please sign in to comment.