| Age | Commit message (Collapse) | Author |
|
|
|
HTTP request now implicitly create request with context.
Any false positive related to not closing HTTP response body has been
annotated with "nolint:bodyclose".
In the example code, use consistent "// Output:" comment format, by
prefixing with single space.
Any comment on code now also prefixing with single space.
An error returned without variables now use [errors.New] instead of
[fmt.Errorf].
Any error returned using [fmt.Errorf] now wrapped using "%w" instead of
"%s".
Also, replace error checking using [errors.Is] or [errors.As], instead
of using equal/not-equal operator.
Any statement like "x = x OP y" now replaced with "x OP= y".
Also, swap statement is simplified using "x, y = y, x".
Any switch statement with single case now replaced with if-condition.
Any call to defer on function or program that call [os.Exit], now
replaced by calling the deferred function directly.
Any if-else condition now replaced with switch statement, if possible.
|
|
There are several reasons that why we move from github.com.
First, related to the name of package.
We accidentally name the package with "share" a common word in English
that does not reflect the content of repository.
By moving to other repository, we can rename it to better and unique
name, in this "pakakeh.go".
Pakakeh is Minang word for tools, and ".go" suffix indicate that the
repository related to Go programming language.
Second, supporting open source.
The new repository is hosted under sourcehut.org, the founder is known
to support open source, and all their services are licensed under AGPL,
unlike GitHub that are closed sources.
Third, regarding GitHub CoPilot.
The GitHub Terms of Service [1], allow any public content that are hosted
there granted them to parse the content.
On one side, GitHub helps and flourish the open source, but on another
side have an issues regarding scraping the copyleft license [2].
[1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us
[2]: https://githubcopilotinvestigation.com
|
|
|
|
There are some reports that I disagree with revive, in example, code
should not declare the type after variables.
In my opinion, on some cases, declaring the type make the code more
readable and explicit.
Since I did not want to add new configuration file, we changes it and
follow revive for now.
|
|
The maxGoroutineUpgrader define maximum goroutines running at the same
time to handle client upgrade.
The new goroutine only dispatched when others are full, so it will
run incrementally not all at once.
Default to defServerMaxGoroutineUpgrader (128) if its not set.
|
|
Replace assignment from using ":=" to use variable declaration with
type.
Rationale: clarity and minimize duplicate temporary variables with the
same type.
|
|
Previously, the test.Assert and test.AssertBench functions has the
boolean parameter to print the stack trace of test in case its not equal.
Since this parameter is not mandatory and its usually always set to
"true", we remove them from function signature to simplify the call
to Assert and AssertBench.
|
|
Previously, there is only one option for server, the port where it will
listen.
This changes add option to change the connect path (default to "/"
previously) and new path and handler for retrieving server status.
|
|
Requesting "GET /health" on WebSocket server will return HTTP status
code 204, which can be used for service health checking.
|
|
|
|
The problem with using the standard http.ReadResponse is that the
received packet may contains WebSocket frame, not just HTTP response.
This cause the initial frame lost, which may required by client (for
example, as a response for authentication).
|
|
User of library that want to create WebSocket client should only focus
to the Endpoint and/or Headers when creating client.
While at it, change handshake test to check for error instead of status
code.
|
|
Unlike HTTP client or other most commmon TCP oriented client, the
WebSocket client is actually asynchronous or passive-active instead of
synchronous.
At any time client connection is open to server, client can receive a
message broadcast from server.
Case examples: if client send "A" to server, and expect that server
response with "A+", server may send message "B" before sending "A+".
Another case is when client connection is open, server may send "B" and
"C" in any order without any request send by client previously.
Due to this model, the way to handle response from server is centralized
using handlers instead of using single send request-response.
|
|
The idea is to allow client to send message without worrying how to
create frame manually. So, the new client provide the following methods:
SendBin, SendClose, SendPing, SendPong, and SendText.
|
|
The client API now contains only NewClient() to create and connect to
remote server, Send() to send package to remote server, and Recv() to
receive package from remote.
All fields and methods that is directly related to client usage are
unexported.
|
|
|
|
|
|
|