When I’m working on developing an OpenTok application, I want to move fast. As a software engineer, I have loads of little workflow shortcuts, scripts, tricks, and favorite tools. When I started to build optk, I wanted to shave off just a couple seconds off of something that I had to do dozens of times a day.
Getting the interactions with Publishers and Subscribers right is a central part of all apps that use the platform. In order to create these objects, I will need a sessionId and token. There’s already a handy shortcut built right into the Dashboard:
But I want to go faster. As a developer, I live inside my Terminal, so wouldn’t it be great if I didn’t have to leave it just to get those values? That’s where optk comes in.
The optk CLI utility outputs a session and token that I can use as a temporary value inside my client application. It is flexible enough to make routed or relayed sessions, tokens with various role based permissions, and many more options. To get it set up, you need node and npm on your development machine, and run the command: npm install -g optk-cli . Place an OpenTok API Key and Secret into a text file named .optk inside your home directory like below:
Now you’re all set up. Use the optk help command to see the commands and optk session -h to understand all the options for a given command.
Building the tool was as simple as wrapping OpenTok Node SDK in a node module, and designing the CLI interface. I’d love to hear if you find it helpful (or not), and hear your suggestions for new functionality. Feel free to contribute or create new issues on GitHub: https://github.com/aoberoi/optk-cli/issues