Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
SockJS-tornado is a Python server side counterpart of SockJS-client browser library <https://github.com/sockjs/sockjs-client>
_
running on top of Tornado <http://tornadoweb.org>
_ framework.
Simplified echo SockJS server could look more or less like:: from tornado import web, ioloop from sockjs.tornado import SockJSRouter, SockJSConnection
class EchoConnection(SockJSConnection):
def on_message(self, msg):
self.send(msg)
if __name__ == '__main__':
EchoRouter = SockJSRouter(EchoConnection, '/echo')
app = web.Application(EchoRouter.urls)
app.listen(9999)
ioloop.IOLoop.instance().start()
(Take look at examples <https://github.com/MrJoes/sockjs-tornado/tree/master/examples>
_ for a complete version).
Subscribe to SockJS mailing list <https://groups.google.com/forum/#!forum/sockjs>
_ for discussions and support.
SockJS provides slightly different API than tornado.websocket
. Main differences are:
tornado.web.RequestHandler
properties.open
callback name to on_open
to be more consistent with other callbacks.write_message
, all messages are sent using send
method. Just in case, send
in tornado.web.RequestHandler
sends raw data over the connection, without encoding it.broadcast
function, which accepts list (or iterator) of clients and message to send.You can pass various settings to the SockJSRouter
, in a dictionary::
MyRouter = SockJSRouter(MyConnection, '/my', dict(disabled_transports=['websocket']))
sockjs-tornado properly works behind haproxy and it is recommended deployment approach.
Sample configuration file can be found here <https://raw.github.com/sockjs/sockjs-node/master/examples/haproxy.cfg>
_.
If your log is full of "WARNING: Connection closed by the client", pass no_keep_alive
as True
to HTTPServer
constructor::
HTTPServer(app, no_keep_alive=True).listen(port)
or::
app.listen(port, no_keep_alive=True)
1.0.2
- Tornado 5.x compatibility fix
1.0.1
1.0.0
- Major version bump. sockjs-tornado can be considered mature
- Python 3 support
- Tornado 3.0 support on both Python 2 and Python 3
- Bug fixes
0.0.5
0.0.4
- Added support for older simplejson library versions
- Fixed installation script
0.0.3
0.0.2
- SockJS 0.2 support and compatibility fixes
0.0.1
Initial release.
FAQs
SockJS python server implementation on top of Tornado framework
We found that sockjs-tornado demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.