(content string)
| 77 | } |
| 78 | |
| 79 | func (d *Document) SetContent(content string) { |
| 80 | d.mu.Lock() |
| 81 | defer d.mu.Unlock() |
| 82 | |
| 83 | d.Content = content |
| 84 | |
| 85 | for ch := range d.Clients { |
| 86 | select { |
| 87 | case ch <- content: |
| 88 | default: |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | } |
| 93 | |
| 94 | func (d *Document) AddClient() chan string { |
| 95 | ch := make(chan string, 10) |