Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RTCQueue standalone library
<?php
namespace Library;
class RTCQueue {
public static function Send($channel, $data) {
$data = array("channel"=>$channel, "data"=>$data);
$address = "127.0.0.1";
$port = "8899";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, $address, $port);
$json = json_encode($data, false)."\r\n";
socket_write($socket, $json);
socket_shutdown ($socket, 2);
socket_close($socket);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment