firecamp-io / firecamp

VSCode for APIs, Postman Alternative.
https://firecamp.dev
317 stars 22 forks source link

Feature request: Add SocketIO emits without payload #96

Closed viktorvorobev closed 4 years ago

viktorvorobev commented 4 years ago

Currently, when I try to emit some SocketIO event with empty Arguments, it seems like it still emits with some argument. The code:

@socketio.on("get configuration")
def get_configuration():
    current_configuration = get_current_configuration()

The error traceback:

: [2020-03-26 15:37:22,259] [    INFO] --- Got websocket message: get configuration, args: (u'',) (logs.py:29)
: Exception in thread Thread-7:
: Traceback (most recent call last):
:   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
:     self.run()
:   File "/usr/lib/python2.7/threading.py", line 754, in run
:     self.__target(*self.__args, **self.__kwargs)
:   File "/usr/lib/python2.7/site-packages/socketio/server.py", line 640, in _handle_event_internal
:     r = server._trigger_event(data[0], namespace, sid, *data[1:])
:   File "/usr/lib/python2.7/site-packages/socketio/server.py", line 669, in _trigger_event
:     return self.handlers[namespace][event](*args)
:   File "/usr/lib/python2.7/site-packages/flask_socketio/__init__.py", line 284, in _handler
:     *args)
:   File "/home/***/***/***/app/logs.py", line 30, in socketio_wrapper
:     return func(handler, message, namespace, sid, *args)
:   File "/usr/lib/python2.7/site-packages/flask_socketio/__init__.py", line 698, in _handle_event
:     ret = handler(*args)
: TypeError: get_configuration() takes no arguments (1 given)

It appears that this argument is an empty string.

Thanks!

Nishchit14 commented 4 years ago

Thanks @victorvorobev, I'll reproduce this at my end to fix it soon.

dmitriyace commented 4 years ago

Faced literally the same issue. v1.1.0

Nishchit14 commented 4 years ago

Thanks, @victorvorobev, and @dmitriyace, This issue has been fixed in v1.2.3