Click here to Skip to main content
15,745,973 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
hi every one please any one tell me how can i create connection with websocket in our c# application.
Actually i want to implement Card payment system in our EPOS application.
so i need to create connection with websocket but i don't know how can i do it.

i also found one link of webscoket in c#
but i cannot understand it clearly.

This is the Websocket Connection URI:


I need to maintain that connection in our EPoS

in a background thread
i also get some information related to websocket but i dont know how can i implement it in our application.

whenever something arrives on that message, or you want to post a message

you just pass it on to the websocket client

ws.Send ("BALUS");

  "jsonrpc": "2.0",
  "method": "connectedTerminals",
  "id": 1

i'm a biggner please i wait for some one help

What I have tried:

i have found this code but i dont know how can i implete this in our application

using System;
using WebSocketSharp;

namespace Example
  public class Program
    public static void Main (string[] args)
      using (var ws = new WebSocket ("ws://dragonsnest.far/Laputa")) {
        ws.OnMessage += (sender, e) =>
            Console.WriteLine ("Laputa says: " + e.Data);

        ws.Connect ();
        ws.Send ("BALUS");
        Console.ReadKey (true);
Updated 11-Jun-19 10:11am

1 solution

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900