WebSocket channel in Python
Javonet allows you to reference and use modules or packages written in (Java/Kotlin/Groovy/Clojure, C#/VB.NET, Ruby, Perl, Python, JavaScript/TypeScript) like they were created in your technology. If you have not yet created your first project, check Javonet overview and quick start guides for your technology.
WebSocket channel is a new way of integrating with remote runtimes hosted on a different machine, container, or service. It uses WebSocket protocol (ws://
or wss://
) to establish communication with a remote runtime and allows secure and efficient method invocation.
You can choose between in-memory (same process), TCP (remote runtime over a TCP porotocol connection), or WebSocket (remote runtime via WebSocket protocol) communication channels depending on your deployment scenario.
To initialize Javonet with WebSocket channel, use the following snippet:
# use Activate only once in your app
Javonet.activate(ActivationCredentials.yourLicenseKey)
from javonet.utils.connectionData.WsConnectionData import WsConnectionData
ws_connection_data = WsConnectionData("ws://127.0.0.1:8080/ws")
communication_channel = Javonet.web_socket(ws_connection_data)
# use communicationChannel to create runtimes to interact with
Communication channel can also be configured using a configuration file. Read more in Configure Channel. After selecting the channel, user selects a runtime to interact with in order to create a Runtime Context.
Was this article helpful?