how do I distinguish an incoming text msg from binary ?
This is a snippet from my script : 
```
require_once("vendor/autoload.php");
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class WebSocketHandler implements MessageComponentInterface {
    public function onOpen(ConnectionInterface $conn) {
		// Handle new WebSocket connection
		echo "New connection! ({$conn->resourceId})\n";
    }

    public function onMessage(ConnectionInterface $from, $msg) {
		// Handle incoming WebSocket message
		$now = DateTime::createFromFormat('U.u', microtime(true));
		echo "New message! " . $now->format("m-d-Y H:i:s.u") . "\n";
		
		$myFile = $now->format("Y-m-d H:i:s.u") . "_" . uniqid() . ".txt";
		$fh = fopen($myFile, 'a');
		fwrite($fh, $msg);
		fclose($fh);
    }
```
When `$msg` contains binary... things don't go as expected.
I suppose because I'm treating the binary content as text.
How can I distinguish the two ?