Message Boards Message Boards

2
|
7971 Views
|
3 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Support for Secure (Web) Sockets in the Wolfram Language?

POSTED BY: Pedro Cabral
3 Replies

Hello Pedro,

Rather than writing that in C, you could use Python's websockets library, so in the meantime you find a solution you can get this done.

I'm sure there is a better way to do it, but you can play around with this

First install websockets:

$ pip3 install websockets

Then:

send = "
import asyncio
import websockets

output : object

async def send():
    global output

    uri = 'wss://echo.websocket.org'

    async with websockets.connect(uri) as websocket:
       await websocket.send('Hello World!')
       output = await websocket.recv()

asyncio.get_event_loop().run_until_complete(send())

output
"

session = StartExternalSession["Python"]
output = ExternalEvaluate[session, send]

Output should be equal to "Hello World!"

POSTED BY: Nicolò Monti

Hi Pedro,

have you been able to come up with a working solution?

POSTED BY: Philipp Winkler

I am also very interested in this for streaming quotes from exchanges and already made a feature request. Hopefully there will be a build in solution in the not too distant future.

POSTED BY: Philipp Winkler
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract