<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#375EAB" />
<title></title>
</head>
<body>
<div class="topbar">
<div class="container">
<div class="top-heading">
<a href="/">github.com/shuLhan/share</a>
</div>
<div class="menu">
<a href="https://godoc.org/github.com/shuLhan/share">GoDoc</a>
</div>
<div class="menu">
<a href="/CHANGELOG.html">Changelog</a>
</div>
</div>
</div>
<div class="page">
<div class="container">
<h1></h1>
<div class="sect1">
<h2 id="_websocket_examples">WebSocket examples</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This package contains an example of chat server and client written using
WebSocket.</p>
</div>
<div class="paragraph">
<p>To run the WebSocket server, go to directory "cmd/server" and execute,</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ go run .</pre>
</div>
</div>
<div class="paragraph">
<p>There are three known user in the server: "Groot", "Thanos", and "Hulk"; all
of them are represented by ID 1, 2, and 3; in order.</p>
</div>
<div class="paragraph">
<p>The client example is in directory "cmd/client", go to that directory and
connect to the server as user "Groot" by executing</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ go run . 1</pre>
</div>
</div>
<div class="paragraph">
<p>or as user "Thanos",</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ go run . 2</pre>
</div>
</div>
<div class="paragraph">
<p>or as user "Hulk",</p>
</div>
<div class="listingblock">
<div class="content">
<pre>$ go run . 2</pre>
</div>
</div>
<div class="paragraph">
<p>Run the server and then two or three clients, and start chatting with each
others.</p>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
Copyright 2019, Shulhan <ms@kilabit.info>. All rights reserved.
<br />
Use of this source code is governed by a BSD-style license that can be
found in the <a href="/LICENSE">LICENSE</a> file.
</div>
</body>
</html>