-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b24ec89
commit 8367e03
Showing
8 changed files
with
187 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# Websocket chat | ||
|
||
A simple chat room made with Lime. | ||
|
||
![img.png](img.png) | ||
|
||
## Requirements | ||
|
||
- [Go 1.17+](https://go.dev/doc/install) | ||
- [NPM 8.1+](https://docs.npmjs.com/getting-started/configuring-your-local-environment) | ||
|
||
## Starting the server | ||
|
||
Go to the `server` directory and run from the source using the command: | ||
```bash | ||
$ go run . | ||
``` | ||
It will start listening for websocket connections in the 8080 port. | ||
|
||
## Building the client | ||
In the `client` directory, run the following command: | ||
```bash | ||
$ npm install | ||
$ npm run build | ||
``` | ||
|
||
This will compile the Javascript bundle to the `client/dist` folder. | ||
Then go to the `client/dist` directory and open the `index.html` in your browser. | ||
Every open instance of this page will connect as a distinct client to the server. | ||
|
||
## References | ||
|
||
- Chat HTML and CSS template: https://codepen.io/sajadhsm/pen/odaBdd | ||
- Icons: https://loading.io/icon | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,56 @@ | ||
<html> | ||
<head> | ||
<title>Lime Chat</title> | ||
</head> | ||
<body> | ||
<link rel="stylesheet" href="chat.css"> | ||
|
||
<section class="msger"> | ||
<header class="msger-header"> | ||
<div class="msger-header-title"> | ||
<i class="fas fa-comment-alt"></i> Lime Chat | ||
</div> | ||
<div class="msger-header-options"> | ||
<span><i class="fas fa-cog"></i></span> | ||
</div> | ||
</header> | ||
|
||
<main class="msger-chat"> | ||
<div class="msg left-msg"> | ||
<div | ||
class="msg-img" | ||
style="background-image: url(https://image.flaticon.com/icons/svg/327/327779.svg)" | ||
></div> | ||
|
||
<div class="msg-bubble"> | ||
<div class="msg-info"> | ||
<div class="msg-info-name">BOT</div> | ||
<div class="msg-info-time">00:00</div> | ||
</div> | ||
|
||
<div class="msg-text"> | ||
Hello, welcome to Lime Chat!<br><br> | ||
The available commands are:<br><br> | ||
<ul> | ||
<li> | ||
<strong>/name [new_nickname]</strong>: Sets a new nickname | ||
</li> | ||
<li> | ||
<strong>/to [nickname] [message]</strong>: Sends a message exclusively to a nickname | ||
</li> | ||
</ul> | ||
<link rel="stylesheet" href="chat.css"> | ||
<section class="msger"> | ||
<header class="msger-header"> | ||
<div class="msger-header-title"> | ||
<i class="fas fa-comment-alt"></i> Lime Chat | ||
</div> | ||
<div class="msger-header-options"> | ||
<span><i class="fas fa-cog"></i></span> | ||
</div> | ||
</header> | ||
|
||
<main class="msger-chat"> | ||
<div class="msg left-msg"> | ||
<div | ||
class="msg-img" | ||
style="background-image: url(../images/bot.png)" | ||
></div> | ||
|
||
<div class="msg-bubble"> | ||
<div class="msg-info"> | ||
<div class="msg-info-name">BOT</div> | ||
</div> | ||
|
||
<div class="msg-text"> | ||
Hello, welcome to Lime Chat!<br><br> | ||
The available commands are:<br><br> | ||
<ul> | ||
<li> | ||
<strong>/name [new_nickname]</strong>: Sets a new nickname | ||
</li> | ||
<li> | ||
<strong>/to [nickname] [message]</strong>: Sends a private message to a nickname | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="msg right-msg"> | ||
<!-- <div--> | ||
<!-- class="msg-img"--> | ||
<!-- style="background-image: url(https://image.flaticon.com/icons/svg/145/145867.svg)"--> | ||
<!-- ></div>--> | ||
<div class="msg right-msg"> | ||
|
||
<!-- <div class="msg-bubble">--> | ||
<!-- <div class="msg-info">--> | ||
<!-- <div class="msg-info-name">Sajad</div>--> | ||
<!-- <div class="msg-info-time">12:46</div>--> | ||
<!-- </div>--> | ||
|
||
<!-- <div class="msg-text">--> | ||
<!-- You can change your name in JS section!--> | ||
<!-- </div>--> | ||
<!-- </div>--> | ||
</div> | ||
</main> | ||
</div> | ||
</main> | ||
|
||
<form class="msger-inputarea"> | ||
<input type="text" class="msger-input" placeholder="Enter your message..."> | ||
<button type="submit" class="msger-send-btn">Send</button> | ||
</form> | ||
</section> | ||
<form class="msger-inputarea"> | ||
<input type="text" class="msger-input" placeholder="Enter your message..."> | ||
<button type="submit" class="msger-send-btn">Send</button> | ||
</form> | ||
</section> | ||
<script src="main.js"></script> | ||
</body> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.