public function javascript($url = null)
    {
         if (!$url) {
            $parts = parse_url(url('/'));
            if (!isset($parts['port'])) {
                $parts['port'] = Config::get('socket.default_port');
            }
            $url = 'ws://' . $parts['host'] . ':' . $parts['port'];
        }

        return implode('', [
            '<script src="' . url('vendor/socket/socket.js') .'"></script>',
            '<script>window.appSocket = new Socket("' . $url . '");</script>'
        ]);
    }
public function javascript($url = null)
    {
         if (!$url) {
            $parts = parse_url(url('/'));
            if (!isset($parts['port'])) {
                $parts['port'] = Config::get('socket.default_port');
            }
            $url = 'ws://' . $parts['host'] . ':' . $parts['port'];
        }

        return implode('', [
            '<script src="' . url('vendor/socket/socket.js') .'"></script>',
            '<script>window.appSocket = new Socket("' . $url . '");</script>'
        ]);
    }
public function javascript ( $ url = null ) { if ( ! $ url ) { $ parts = parse_url ( url ( '/' ) ) ; if ( ! isset ( $ parts [ 'port' ] ) ) { $ parts [ 'port' ] = Config :: get ( 'socket.default_port' ) ; } $ url = 'ws://' . $ parts [ 'host' ] . ':' . $ parts [ 'port' ] ; } return implode ( '' , [ '<script src="' . url ( 'vendor/socket/socket.js' ) . '"></script>' , '<script>window.appSocket = new Socket("' . $ url . '");</script>' ] ) ; }
Includes the javascript file and initializes the Socket javascript object.

@return string
Includes the javascript file and initializes the Socket javascript object .