Skip to content

Undefined Index 1 on line  #8

Open
@ban1989ban

Description

@ban1989ban

I am using this socket.io.php file.
When i am calling the send function, i am gettting error message on this line

preg_match('#Sec-WebSocket-Accept:\s(.*)$#mU', $result, $matches);

Basically the $result on the line above is coming blank.($result= fread($fd,10000);)
But i am not able to identify what is the issue.
On my nodejs server, as the hit is made, this error is coming
* warn - unknown transport: "undefined"*

My code for emitting event is

if ($socketio->send('localhost', 8080, "message","hello")){
echo "we sent the message and disconnected \n";
} else {
echo 'Sorry, we have a mistake :'(';
}

My Nodejs Server

var socket = require('socket.io');
var express = require('express');
var http = require('http');

var app = express();
var server = http.createServer(app);

var io = socket.listen(server);
console.log('hereeee');
io.sockets.on('connection', function(client) {

client.on('message', function(data) {
    console.log('Message received ' + data.count);
    //io.sockets.emit('message', { data : data.count});
});

});

server.listen(8080);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions