Configure channel in GoLang app

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. Javonet enables configuring the communication channel with foreign runtimes via a configuration file. Each runtime section (jvm, netcore, nodejs, python, ruby, clr, perl) can be configured independently with one of the supported channel types:

  • In-Memory Channel – high-performance, within-process communication, Learn more ›
  • TCP Channel – for inter-process or remote communication over TCP, Learn more ›
  • WebSocket Channel – ideal for browser-based or cross-platform communication, Learn more ›

Example configuration file with all three channel types:

{
  "licenseKey": "your-license-key",
  "runtimes": {
    "jvm": [
      {
        "name": "default",
        "customOptions": "",
        "modules": "",
        "channel": {
          "type": "inMemory"
        }
      }
    ],
    "netcore": [
      {
        "name": "default",
        "customOptions": "",
        "modules": "",
        "channel": {
          "type": "tcp",
          "host": "127.0.0.1",
          "port": 8080
        }
      }
    ],
    "nodejs": {
      "name": "default",
      "customOptions": "",
      "modules": "",
      "channel": {
        "type": "webSocket",
        "host": "wss://127.0.0.1:443/ws",
        "port": 0
      }
    }
  }
}

To use this file, load it using:

I code in:
// use Activate only once in your app
_, err := Javonet.Activate(activationcredentials.YourLicenseKey)
if err != nil {
	fmt.Println("Error: " + err.Error())
}

// set up variables
configFilePath := resourcesDirectory + "/channel-tests-config.json"
communicationChannel := Javonet.WithConfig(configFilePath)
// use communicationChannel to create runtimes to interact with

Javonet can be used both in Node.js and in browser-based JavaScript environments.
When using Javonet.withConfig(...), you are not limited to providing a configuration file path — you can also pass:

  • JavaScript object – representing the configuration structure directly in code.
  • JSON string – containing the configuration as a raw JSON-formatted string.

This flexibility allows seamless integration regardless of your runtime environment. You can use configuration from a file, a JavaScript object, or a JSON string depending on your use case. Below you can see a code example demonstrating how to load configuration from JavaScript object source.

// use Activate only once in your app
Javonet.activate(ActivationCredentials.yourLicenseKey)

// Set up configuration Object
let configObject = {
  runtimes: {
    jvm: [
      {
        name: 'default',
        customOptions: '',
        modules: './',
        channel: {
          type: 'inMemory',
        },
      },
    ],
  }
};

let communicationChannel = Javonet.withConfig(configObject)
// use communicationChannel to create runtimes to interact with