initail
This commit is contained in:
+6
-2
@@ -3,13 +3,17 @@
|
||||
<script>
|
||||
const socket = io("http://localhost:8201", {
|
||||
path: '/ws/socket.io',
|
||||
query: 'id=channel'
|
||||
query: 'id=1000_channel'
|
||||
});
|
||||
socket.on('data', (arg) => {
|
||||
socket.on('data', (arg, callback) => {
|
||||
const doc = document.getElementById('test');
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = JSON.stringify(arg);
|
||||
doc.append(div);
|
||||
|
||||
callback({
|
||||
received: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
+5
-2
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$ch = curl_init('http://push:8080/pub/channel');
|
||||
$uid = mt_rand(100,400000);
|
||||
$ch = curl_init('http://push:8080/pub/'. $uid .'_channel');
|
||||
# Setup request to send json via POST.
|
||||
$payload = json_encode( array( "customer"=> $argv[1]) );
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
|
||||
@@ -11,4 +12,6 @@ $result = curl_exec($ch);
|
||||
var_export($result);
|
||||
curl_close($ch);
|
||||
# Print response.
|
||||
echo "<pre>$result</pre>";
|
||||
//echo "<pre>$result</pre>";
|
||||
//8839716547:AAHNDG5ezuBxKHVaFCIivq2hWrNjFxDMHMs
|
||||
// 234706670
|
||||
Reference in New Issue
Block a user