Skip to content

Commit 55469ab

Browse files
committed
typos
1 parent b3681ab commit 55469ab

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The `Stream` object implements an `http.Handler` for you so it can be registered
2424
You got it! What do you need?
2525

2626
## Multiplexing / Topics / Rooms / Channels
27-
We call them "topics" but the gist is the same. All Clients always recieve `Broadcast` events, but you can `Publish` events to a specific topic, and then only clients that have `Subscribe`d to that topic will recieve the event.
27+
We call them "topics" but the gist is the same. All Clients always receive `Broadcast` events, but you can `Publish` events to a specific topic, and then only clients that have `Subscribe`d to that topic will receive the event.
2828

2929
```go
3030
stream.Subscribe("weather", myClient)
@@ -59,7 +59,7 @@ http.ListenAndServe(":8080", catsHandler)
5959
Use the stream's `Register`, `Subscribe`, `Remove`, `Unsubscribe`, and `CloseTopic` functions to control which clients are registered where.
6060

6161
## Tell me when clients connect
62-
Register a callback for the `Stream` to envoke everytime a new client connects with `Stream.ClientConnectHook`. It'll give you a handle to the resulting Client and the http request that created it, letting you do whatever you please.
62+
Register a callback for the `Stream` to invoke every time a new client connects with `Stream.ClientConnectHook`. It'll give you a handle to the resulting Client and the http request that created it, letting you do whatever you please.
6363

6464
```go
6565
stream := eventsource.NewStream()
@@ -71,13 +71,13 @@ stream.ClientConnectHook(func(r *http.Requset, c *eventsource.Client){
7171
})
7272
```
7373

74-
The callback will be on the same goroutine as the incoming web request that created it, but the Client is live and functioning so it'll start recieving broadcasts and publishments immediately before your callback has returned.
74+
The callback will be on the same goroutine as the incoming web request that created it, but the Client is live and functioning so it'll start receiving broadcasts and publications immediately before your callback has returned.
7575

7676
## Graceful shutdown
77-
The stream's `Shutdown` command will unsubscribe and disconnect all connected clients. However the `Stream` itself is not running any background routines, and may continue to register new clients if it's still registed as an http handler.
77+
The stream's `Shutdown` command will unsubscribe and disconnect all connected clients. However the `Stream` itself is not running any background routines, and may continue to register new clients if it's still registered as an http handler.
7878

7979
## Get out of my way
80-
Fine! The `Stream` object is entirely convinience. It runs no background routines and does no special handling. It just adds the topics abstraction and calls `NewClient` for you when it's connected to. Feel free not to use it.
80+
Fine! The `Stream` object is entirely convenience. It runs no background routines and does no special handling. It just adds the topics abstraction and calls `NewClient` for you when it's connected to. Feel free not to use it.
8181

8282
# More control of the `Client`
8383
You betcha.
@@ -101,12 +101,12 @@ func ServeHTTP(w http.ResponseWriter, r *http.Request) {
101101
Letting the http handler routine that created the Client return may cause the underlying connection to be closed by the server. Since `NewClient` does not block, use `Wait` to block until the client is shutdown.
102102

103103
## Shutdown the client
104-
The client's `Shutdown` function terminates the background routine and marks the client as closed. It does not actually sever the connection. It does unblock any routines waiting on `Wait`, which assuming the main http hander routine was waiting there, will cause the connection to close as it returns.
104+
The client's `Shutdown` function terminates the background routine and marks the client as closed. It does not actually sever the connection. It does unblock any routines waiting on `Wait`, which assuming the main http handler routine was waiting there, will cause the connection to close as it returns.
105105

106106
Attempts to `Send` events to a client after it has been shutdown will result in an error
107107

108108
# More control of Events
109-
Events are the most critical part of the library, and are the most versitile.
109+
Events are the most critical part of the library, and are the most versatile.
110110

111111
## Write my own events from scratch
112112
Events implement the `io.ReadWriter` interface so that data can be written to it from practically any source. However the `Write` interface _does not_ write an entire event in wire format. It writes the provided buffer into `data:` sections in the resulting event.
@@ -135,7 +135,7 @@ newEvent.WriteRaw(evData) // that will work
135135
newEvent.AppendData("Moar") // ... and you ruined it
136136
```
137137

138-
Use `Clone` to create a perfect deep copy that survives further mutation. Though this is less efficient in memeory.
138+
Use `Clone` to create a perfect deep copy that survives further mutation. Though this is less efficient in memory.
139139

140140
## Create events more easily
141141
Since you will probably be creating more than just a few events, the `EventFactory` interface and a couple helper factories and functions have been provided to speed things up.

event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (e *Event) Write(p []byte) (int, error) {
119119
}
120120

121121
// WriteString adds string data to the event.
122-
// Equivilant to calling Write([]byte(string))
122+
// Equivalent to calling Write([]byte(string))
123123
func (e *Event) WriteString(p string) {
124124
// split event on newlines
125125
split := strings.Split(p, "\n")

stream.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Package eventsource is a library for dealing with server sent events in Go.
44
The library attempts to make as few assumptions as possible about how your apps
55
will be written, and remains as generic as possible while still being simple and useful.
66
7-
The three core obects to the library are Clients, Events, and Streams.
7+
The three core objects to the library are Clients, Events, and Streams.
88
99
Client wraps an HTTP connection, and runs a worker routine to send events to the connected
1010
client in a thread-safe way. It gracefully handles client disconnects.
@@ -14,7 +14,7 @@ it to wire format to send. Events are not thread-safe by themselves.
1414
1515
Stream is an abstraction for 0 or more Client connections, and adds some multiplexing and filtering
1616
on top of the Client. It also can act as an http.Handler to automatically register inbound client
17-
connections and disconnectinos.
17+
connections and disconnections.
1818
1919
A quick example of a simple sever that broadcasts a "tick" event every second
2020

0 commit comments

Comments
 (0)