public function run() { $socket = new sockets(); $chatbot = new chatbot(); $socket->onOpen(IP, PORT); $chatbot->sendLogin($socket->socket, USERNAME, PASSWORD); $chatbot->joinChannel($socket->socket, CHANNEL); while (true) { $socket->onMessage(); //$chatbot->autotalk($socket->socket); // be carefully, the Bot goes crazy ;-) } }