diff --git a/README.MD b/README.MD index 66cebdf..9597788 100644 --- a/README.MD +++ b/README.MD @@ -11,7 +11,7 @@ Channels are popular in golang for sharing data. In the golang training i took, ### Organisation of files | File name | Description | | -----| ---| -| main.go | This is startup file. The `init()` , which by defualt gets called first before `main()` initializes the necessary configuration such as the server host,port and log files . The `main()` creates a `chat.NewServer` type and starts a `go routine` to listen on the server. Apart from it, the `main()` also create a webserver and route handler to load the inital page of the application | +| main.go | This is startup file. The `init()` , which by default gets called first before `main()` initializes the necessary configuration such as the server host,port and log files . The `main()` creates a `chat.NewServer` type and starts a `go routine` to listen on the server. Apart from it, the `main()` also create a webserver and route handler to load the inital page of the application | | server.go | The server file has `Server` struct defined with essential fields. The `Server` glues everything together. `server.go` has different functions defined for perfoming activities in a chat room such as The `Listen()` is triggerd as a `go routine` from `main()`. The `Listen()` handles a separate http route `/chat` which is used by `ws` protocol for communicating with the server. The `Listen()` has an infinite `for` loop that has a `select` to match case for different channel operations | | user.go | The `user.go` is representation of a user. I have a struct defined called `User` which has the props for the user. `NewUser` gets created whenever a new websocket connection is established. There are two main functions here `listenRead()` and `listenWrite()` that helps in listening for new incoming and outgoing messages. `listenWrite()` is triggered as a separate `go routine` | | message.go | This is a simple struct that defines how a message look like |