Commit Graph

73 Commits

Author SHA1 Message Date
Canelo Hill a70cea529a
Update for deprecated ioutil package (#931) 2024-06-19 14:44:41 +10:00
apoorvajagtap ce903f6d1d Reverts to v1.5.0
This commit reverts the changes back till 8983b96324.
And inherits the README.md changes of 931041c5ee
Relates to:
- https://github.com/gorilla/websocket/issues/880#issuecomment-2081189055
2024-06-13 23:18:03 -04:00
apoorvajagtap 1bddf2e0db bumps go version & removes deprecated module usage 2024-05-01 18:51:54 +05:30
apoorvajagtap b2c246b2ec Revert " Update go version & add verification/testing tools (#840)"
This reverts commit 666c197fc9.
2024-05-01 18:51:54 +05:30
rfyiamcool d293aa53e1 feat: format message type
Signed-off-by: rfyiamcool <rfyiamcool@163.com>
2024-02-13 23:01:06 -05:00
rfyiamcool 316861440d fix: lint example
Signed-off-by: rfyiamcool <rfyiamcool@163.com>
2024-02-13 22:50:58 -05:00
Alan Xu 871f6bbc74
docs(echoreadall): fix function echoReadAll comment (#881)
As of Go 1.16, ioutil.ReadAll was deprecated.
2024-01-18 16:21:03 +10:00
fengyun.rui 286c896192
fix: replace ioutil.readfile with os.readfile (#868)
### summay

`ioutil.ReadFile` is Deprecated, As of Go 1.16, this function simply
calls [os.ReadFile].

Signed-off-by: rfyiamcool <rfyiamcool@163.com>
2023-12-06 23:58:12 -05:00
mstmdev b6a0d77c05
Update README.md, replace master to main (#862)
<!--
For Work In Progress Pull Requests, please use the Draft PR feature,
see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for
further details.

     For a timely review/response, please avoid force-pushing additional
     commits if your PR already received reviews or comments.

     Before submitting a Pull Request, please ensure that you have:
- 📖 Read the Contributing guide:
https://github.com/gorilla/.github/blob/main/CONTRIBUTING.md
- 📖 Read the Code of Conduct:
https://github.com/gorilla/.github/blob/main/CODE_OF_CONDUCT.md

     - Provide tests for your changes.
     - Use descriptive commit messages.
	 - Comment your code where appropriate.
	 - Squash your commits
     - Update any related documentation.

     - Add gorilla/pull-request-reviewers as a Reviewer
-->

## What type of PR is this? (check all applicable)

- [ ] Refactor
- [ ] Feature
- [ ] Bug Fix
- [ ] Optimization
- [x] Documentation Update
- [ ] Go Version Update
- [ ] Dependency Update

## Description

## Related Tickets & Documents

<!--
For pull requests that relate or close an issue, please include them
below. We like to follow [Github's guidance on linking issues to pull
requests](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).

For example having the text: "closes #1234" would connect the current
pull
request to issue 1234.  And when we merge the pull request, Github will
automatically close the issue.
-->

- Related Issue #
- Closes #

## Added/updated tests?

- [ ] Yes
- [x] No
- [ ] I need help with writing tests

## Run verifications and test

- [ ] `make verify` is passing
- [ ] `make test` is passing
2023-11-08 13:57:41 -05:00
Corey Daley 666c197fc9
Update go version & add verification/testing tools (#840)
Fixes #

**Summary of Changes**

1.
2. 
3.

> PS: Make sure your PR includes/updates tests! If you need help with
this part, just ask!
2023-08-27 01:31:45 +05:30
LiuYang 80393295c1
Correct way to save memory using write buffer pool and freeing net.http default buffers (#761)
**Summary of Changes**

1. Add an example that uses the write buffer pool

The loop process of the websocket connection is inner the http handler
at existing examples, This usage will cause the 8k buffer(4k read buffer
+ 4k write buffer) allocated by net.http can't be GC(Observed by heap
profiling, see picture below) . The purpose of saving memory is not
achieved even if the WriteBufferPool is used.

In example bufferpool, server process websocket connection in a new
goroutine, and the goroutine created by the net.http will exit, then the
8k buffer will be GC.


![heap](https://user-images.githubusercontent.com/12793501/148676918-872d1a6d-ce10-4146-ba01-7de114db09f5.png)

Co-authored-by: hakunaliu <hakunaliu@tencent.com>
Co-authored-by: Corey Daley <cdaley@redhat.com>
2023-08-17 11:25:09 -04:00
Gary Burd 2d6ee4c55c
Update autobahn example
- Update instructions to use docker.
- Cleanup config file.
2022-01-02 11:21:21 -08:00
Rn 2c89656910
Modify http Method String Literal to Variable (#728) 2021-12-19 11:21:45 -05:00
Gary Burd 1905f7e442
Update source to match output from gofmt 1.17 2021-12-17 22:48:51 -05:00
hellflame e8629af678
improve echo example (#671) 2021-04-24 09:20:22 -07:00
Sry Back I 81cef7da56
echo example: handle received messages as text, not HTML (#563) 2020-03-19 06:53:02 -07:00
Rubi e90f6db575
input autofocus (#564) 2020-03-19 06:50:48 -07:00
Ankur Gupta 95ba29eb98 Updated autobahn test suite URL
Fixes #436
2018-12-05 23:02:39 -08:00
Petr cd94665a65 Minor fixes in comments
* Fix typo

"netowrk" is a misspelling of "network"

* Fix export comment

Comment on exported type Hub should be of the form "Hub ..." (golint)
2018-04-15 20:20:28 -07:00
unknown 0647012449 Modify http status code to variable 2018-02-28 13:09:02 -08:00
claudia-jones 8fbc40be62 Simplify echo example client (#349)
Use existing `done` channel to signal that reader is done instead of closing the connection.
2018-02-18 16:00:50 -08:00
Gary Burd 58729a2165
Don't log 1006 error in chat example
This error is expected (Safari closes connections without sending a close
frame).

Fixes #323
2018-01-09 12:15:58 -08:00
Jordan Pittier cdedf21e58 examples/chat/client.go: avoid allocating []byte{} for PingMessage (#312)
It's useless and only gives more work to the GC.
2017-12-09 19:53:53 -08:00
fising 2b58522131 update README.md 2017-11-29 07:20:15 -08:00
Alain Gilbert 5755884efa
Add missing html tag in example/echo 2017-09-26 16:13:09 -07:00
Gary Burd ea4d1f681b Reduce memory used in chat example 2017-06-20 12:01:03 -07:00
Gary Burd 5ade364dff Improve examples
- Remove jQuery dependency in command example.
- Fix auto scroll on new content in chat and command example.
- Update chat and command example to use a static HTML file.
2017-02-15 17:01:07 -08:00
Gary Burd 804cb600d0 Prepared Messages (#211) 2017-02-14 09:41:18 -08:00
Shrumit Mehta 9bc973af06 Change text/template to html/template in the examples
Change text/template to html/template in examples
2017-02-13 10:21:12 -08:00
Aleksandr Andrienko 0e7877a5a1 Fix up README.md for command example. 2016-12-27 15:04:14 +02:00
Shivam Mamgain dc13401989 Fix documentation
Specify correct function name in README
2016-11-12 16:02:12 +05:30
Gary Burd 2aff870ef8 Improve command example
- Close connection cleanly on EOF from command.
2016-10-27 21:05:23 -07:00
Gary Burd 6257d10a8b Improve chat example
- Discuss concurrency and message coalescing in the README.
- Add comments to client.go explaining how concurrency requirements are
  met.
- Prevent developers from calling the Client.write method from outside
  of the writePump goroutine by removing the method. The code is now
  inlined in Client.writPump.
2016-10-25 16:48:54 -07:00
Gary Burd a0ef436d00 compression: add tests, rename option 2016-10-17 17:30:22 -07:00
Sam Broughton 295028b997 Fix typos in chat example 2016-08-02 07:24:52 +01:00
Gary Burd 5e2e56d5df Improve chat example
- Remove jQuery.
- Rename Conn to Client to avoid confusion with underlying ws
  connection.
- Remove global variables.
2016-07-18 16:08:34 -07:00
Ryan Havar b5afd49817 Update hub.go 2016-07-10 23:15:05 -05:00
Gary Burd 54f9decdbf Add description to the chat example readme 2016-07-01 11:57:38 -07:00
Gary Burd a68708917c Coalesce outbound messages in chat example 2016-06-06 16:20:22 -07:00
Gary Burd afffb15196 Merge branch 'varnames' 2016-05-26 21:01:19 -07:00
Gary Burd 24cddddcc0 Use single character receiver names in chat example 2016-05-26 21:00:24 -07:00
Gary Burd 2301bcbf5c Cleanup js in chat example 2016-05-26 10:19:40 -07:00
Jean de Klerk be95f72b73 Meaningful names for connection, message 2016-05-18 08:57:16 -06:00
Jean de Klerk a6108176e8 Meaningful names for hub 2016-05-18 08:56:16 -06:00
Gary Burd 6b3d49710b Fix filewatch example
Use last modified time when the time is parsed without error. This prevents an
extra file read at start of watch for a connection.

Fixes #125.
2016-04-21 17:30:17 -07:00
Gary Burd 5434f8b69b Improve IsUnexpectedCloseError examples 2016-01-19 18:24:46 -08:00
Gary Burd 844dd6d40e Add closing handshake code to echo example client 2015-12-09 16:50:38 -08:00
Gary Burd 361d4c0ffd Improve echo web UI
Based on feedback from anon.
2015-11-02 11:10:34 -08:00
Gary Burd c93e5540b8 Add web client to echo example 2015-11-02 10:39:51 -08:00
Gary Burd 567453a710 Require GET in Upgrader.Upgrade.
Return error if the request method is not GET.

Remove all request method tests from the examples.
2015-11-02 09:08:11 -08:00