basic-chat

command module
v0.0.0-...-c5a4a64 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 17 Imported by: 0

README

basic-chat

Simple chat server using golongpoll. Provides a single chat room with HTTP Basic Auth users.

To Build

go build basic-chat.go

To Run

./basic-chat -serve 127.0.0.1:8080 -static ./static/ -accounts "username1:password1,username2:password2,username3:password3"

Then visit http://127.0.0.1:8080 and log in using HTTP basic auth with one of the accounts.

Configuring

Configure via command-line arguments:

  • -serve specifies the address to serve HTTP.
  • -static specifies where the ./static/ directory is located for serving via HTTP. This must be relative to where the executable is run from or an absolute path..
  • -saveChatsTo is the filename to persist chats to. This way chat history is preserved across server restarts.
  • -accounts is a comma delimited list of username:password accounts. Only these users will be allowed to chat.
  • -historySize is the number of chats to retain per chat room, defaults to 250. This history is present entirely in-memory as well as persisted to disk.

Note: to add a user, simply restart with an updated -accounts param.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL