iot-lab / ws-cli-tools
Showing 1 of 1 files from the diff.

@@ -78,7 +78,10 @@
Loading
78 78
                yield gen.sleep(0.1)
79 79
                self.websocket = None
80 80
                return
81 -
            data += recv
81 +
            try:
82 +
                data += recv.decode('utf-8')
83 +
            except UnicodeDecodeError:
84 +
                continue
82 85
            lines = data.splitlines(True)
83 86
            data = ''
84 87
            for line in lines:
@@ -99,7 +102,8 @@
Loading
99 102
    def __init__(self, connections):
100 103
        self.clients = {
101 104
            '{0.node}.{0.site}'.format(connection): WebsocketClient(
102 -
                connection, con_type='serial') for connection in connections
105 +
                connection, con_type='serial/raw')
106 +
            for connection in connections
103 107
        }
104 108
105 109
    @staticmethod
@@ -107,7 +111,8 @@
Loading
107 111
        if client.websocket is None:
108 112
            # don't send to a disconnected client
109 113
            return
110 -
        client.websocket.write_message(message + '\n')
114 +
        msg = message + '\n'
115 +
        client.websocket.write_message(msg.encode(), binary=True)
111 116
112 117
    def _send_all_clients(self, message):
113 118
        for client in self.clients.values():
Files Coverage
iotlabwscli 72.79%
Project Totals (6 files) 72.79%
37.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=
38.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
38.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=
39.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
35.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
35.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=
36.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=
37.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
39.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=
40.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
24.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
27.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=
29.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
56.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=
56.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
54.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=
54.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
55.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=
55.1
TRAVIS_PYTHON_VERSION=2.7
TRAVIS_OS_NAME=linux
TOXENV=
52.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
TOXENV=