invisibleroads / invisibleroads/socketIO-client

receive extra character when on listening

Open
#165 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
441
Forks
204
PR merge metrics
No merged PRs in 30d

Description

# receive extra character when using .on listening method

### client side (python)
python 2.7
OSX
```
import logging
from socketIO_client import SocketIO, BaseNamespace

logging.getLogger('socketIO-client').setLevel(logging.DEBUG)
logging.basicConfig()

def on_test_response(*args):
print('on_test_response', args)

def on_connect():
print('connect')

def on_disconnect():
print('disconnect')

def on_fps_com_response(*args):
print('on_fps_com_response', args)

class FpsNamespace(BaseNamespace):

def on_fps_com_response(self, *args):
print('on_fps_com_response', args)

socketIO = SocketIO('https://localhost', 8080, verify=False)
FpsNamespace = socketIO.define(FpsNamespace, '/fps-namespace')

data = ''

FpsNamespace.emit('fps_com', 'aaa')
FpsNamespace.on('fps_com', on_fps_com_response)

socketIO.wait(seconds=5)
```

_what receive from the **client-end** (received the unexpected)_

_expect to receive_
`copy`
_actual recieve_
`(u'copy',)`

### server side code
"socket.io": "^1.7.3"
nodeJs 8.6.0
OSX

```
const fps_nsp = io.of('/fps-namespace');
fps_nsp.on('connection', (socket) => {
// socket.emit('fps_com', { hello: 'Hey there browser!' });
socket.on('fps_com', (data) => {
console.log(data);
socket.emit('fps_com', 'copy');
});
socket.on('disconnect', () => {
console.log('Socket disconnected');
});
});
```
_what recieve from the **server-end** (recieved as expected)_
`aaa`

_If I change the code in client side (python) from `verify=False to verify='cert.pem'`
I got an error_

ERROR:urllib3.connection:Certificate did not match expected hostname: localhost. Certificate: {'notBefore': u'Aug 29 09:08:30 2017 GMT', 'serialNumber': u'9A6416AB3B2A6919', 'notAfter': 'Aug 29 09:08:30 2018 GMT', 'version': 3L, 'subject': ((('countryName', u'TH'),), (('stateOrProvinceName', u'xxx'),), (('localityName', u'xxx'),), (('organizationName', u'Fps moonshot Ltd'),), (('organizationalUnitName', u'Fps developer'),), (('commonName', u'xxx'),), (('emailAddress', u'email@hotmail.com'),)), 'issuer': ((('countryName', u'TH'),), (('stateOrProvinceName', u'xxx'),), (('localityName', u'xxx'),), (('organizationName', u'Fps moonshot Ltd'),), (('organizationalUnitName', u'Fps developer'),), (('commonName', u'xxx'),), (('emailAddress', u'email@hotmail.com'),))}
WARNING:socketIO-client-2:localhost:8080/socket.io [waiting for connection] HTTPSConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /socket.io/?EIO=3&transport=polling&t=1504204491104-0 (Caused by SSLError(CertificateError("hostname 'localhost' doesn't match u'xxx'",),))
> Ps. Sorry for being a newbie and Thank you for answering

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.