# -*- coding: utf-8 -*-
import asyncio
import websockets
import logging
import json

from jsonrpcclient.clients.websockets_client import WebSocketsClient

from .rpc import Rpc

log = logging.getLogger(__name__)


class Websocket(Rpc):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.ws = None
        self.client = None

    async def connect(self):
        self.ws = await websockets.connect(self.url, ssl=True, loop=self.loop)
        self.client = WebSocketsClient(self.ws)

    async def disconnect(self):
        if self.ws:
            await self.ws.close()

    async def rpcexec(self, *args):
        """ Execute a RPC call

            :param args: args are passed as "params" in json-rpc request:
                {"jsonrpc": "2.0", "method": "call", "params": "[x, y, z]"}
        """
        if not self.ws:
            await self.connect()

        log.debug(json.dumps(args))

        response = await self.client.request("call", *args)

        # Return raw response (jsonrpcclient does own parsing)
        return response.text

@@ -383,32 +383,86 @@
  connect(self):%0A
+        ssl = True if self.url%5B:3%5D == %22wss%22 else None%0A
         self.ws 
@@ -502,20 +502,19 @@
 rl, ssl=
-True
+ssl
 , loop=s

Handle non-ssl websocket