function send($op,$data='') {
		$server=$this->server;
		$mask=WS::Finale | $op & WS::OpCode;
		$len=strlen($data);
		$buf='';
		if ($len>0xffff)
			$buf=pack('CCNN',$mask,0x7f,$len);
		else
		if ($len>0x7d)
			$buf=pack('CCn',$mask,0x7e,$len);
		else
			$buf=pack('CC',$mask,$len);
		$buf.=$data;
		if (is_bool($server->write($this->socket,$buf)))
			return FALSE;
		if (!in_array($op,[WS::Pong,WS::Close]) &&
			isset($this->events['send']) &&
			is_callable($func=$this->events['send']))
			$func($this,$op,$data);
		return $data;
	}
function send($op,$data='') {
		$server=$this->server;
		$mask=WS::Finale | $op & WS::OpCode;
		$len=strlen($data);
		$buf='';
		if ($len>0xffff)
			$buf=pack('CCNN',$mask,0x7f,$len);
		else
		if ($len>0x7d)
			$buf=pack('CCn',$mask,0x7e,$len);
		else
			$buf=pack('CC',$mask,$len);
		$buf.=$data;
		if (is_bool($server->write($this->socket,$buf)))
			return FALSE;
		if (!in_array($op,[WS::Pong,WS::Close]) &&
			isset($this->events['send']) &&
			is_callable($func=$this->events['send']))
			$func($this,$op,$data);
		return $data;
	}
function send ( $ op , $ data = '' ) { $ server = $ this -> server ; $ mask = WS :: Finale | $ op & WS :: OpCode ; $ len = strlen ( $ data ) ; $ buf = '' ; if ( $ len > 0xffff ) $ buf = pack ( 'CCNN' , $ mask , 0x7f , $ len ) ; else if ( $ len > 0x7d ) $ buf = pack ( 'CCn' , $ mask , 0x7e , $ len ) ; else $ buf = pack ( 'CC' , $ mask , $ len ) ; $ buf .= $ data ; if ( is_bool ( $ server -> write ( $ this -> socket , $ buf ) ) ) return FALSE ; if ( ! in_array ( $ op , [ WS :: Pong , WS :: Close ] ) && isset ( $ this -> events [ 'send' ] ) && is_callable ( $ func = $ this -> events [ 'send' ] ) ) $ func ( $ this , $ op , $ data ) ; return $ data ; }
Frame and transmit payload
@return string|FALSE
@param $socket resource
@param $op int
@param $payload string
Frame and transmit payload