WEBSOCKETD : Full duplex messaging between web browsers and servers

artydev - Jan 11 '21 - - Dev Community

Awesome tool which turns any console application in WebSocket Server, whatever programming language you use.
Available for Windows, Linux, Mac

Try it, really awesome

WebSocketd

#!/usr/bin/python
from sys import stdout
from time import sleep

# Count from 1 to 10 with a sleep
for count in range(0, 10):
  print(count + 1)
  stdout.flush()
  sleep(0.5)
Enter fullscreen mode Exit fullscreen mode
#!/bin/bash

# Count from 1 to 10 with a sleep
for ((COUNT = 1; COUNT <= 10; COUNT++)); do
  echo $COUNT
  sleep 0.5
done
Enter fullscreen mode Exit fullscreen mode
using System;
using System.Threading;

class Counter
{
  static void Main()
  {
    for (int i = 1; i <= 10; i++)
    {
      Console.WriteLine(i);
      Thread.Sleep(500);
    }
  }
}
Enter fullscreen mode Exit fullscreen mode
#include <stdio.h>
#include <unistd.h>

int main() {
    int i;

    // Disable output buffering.
    setbuf(stdout, NULL);

    for (i = 1; i <= 10; i++) {
        printf("%d\n", i);
        usleep(500000);
    }

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Launch the server with the following command

c:\> websocketd --port=8080 my-program
Enter fullscreen mode Exit fullscreen mode

and in Javascript

var ws = new WebSocket('ws://localhost:8080/');

ws.onmessage = function(event) {
  console.log('Count is: ' + event.data);
};
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player