-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typing improvements for io
and fixes for websocketclient
, and a few others
#1429
base: public
Are you sure you want to change the base?
Conversation
…cket extend Device; improvements overall on types
…ts), fix bug with masks on fragmented reads, and add mask decode to control messages
io and fixes for
websocketclient`, and a few othersio
and fixes for websocketclient
, and a few others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this change. It must fix a problem you see. But, it also would require the caller to set host
, port
, and path
in the options object, which isn't what we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - on review I see I misunderstood what it was doing. I'll fix...
Fixes are in place. Let me know what else you find.. |
- tls extends tcp instead of full definition - Add 'undefined' as possible `read` result
set format(format: string); | ||
get format(): string; | ||
} | ||
export default class TLSSocket extends TCP {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm no TypeScript expert, but don't you need to define that the TLSSocket constructor uses TLSOptions
instead of TCPOptions
for the options object argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for filling this in. The change is good. I don't want even more copies of the HTTP status code map in the repo. I'll make a module for those so it can be shared. But that doesn't need to hold this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
419 UDP only specifies udp.read()
- no argument and returns ArrayBuffer augmented with port
and address
. It does not specify multicast (though that's definitely on the roadmap)
socket: TCPDevice | TLSDevice; | ||
port?: number; | ||
host: string; | ||
dns: DNSUDPDevice; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no requirement that this is a DNS using UDP. It could be another resolution transport. But, for the moment this is probably OK?
This is the work I've done to date with
io
focused on makingwebsocketclient
to be reliable and strongly typed with TypeScript. It's a fairly substantial set of changes, mostly in the.d.ts
files but some implementation (especiallywebsocketclient
).Type changes:
embedded:io/socket/tcp/tls
,embedded:network/http/server
,embedded:network/http/server/options/webpage
,embedded:network/https/server/options/websocket
, andembedded:network/websocket/client
embedded:io/socket/listener
,embedded:io/socket/tcp
,embedded:io/socket/udp
,embedded:network/dns/resolver/udp
,embedded:network/http/client
,embedded:provider/builtin
Device
(for global variabledevice
) into global types to eliminate requirement for importDevice
for when imports of extended modules are used (support forembedded:network/http/server
,embedded:network/websocket/client
)Implementation changes:
websocketclient
:onError(error: string)
(new feature)websocket
where using attached sockets would fail (reported inembedded:io/socket/listener
locks up Win simulator #1428)httpserver
on theHTTP/1.1 <status> <code>
headerembedded:network/http/server/options/webpage
to support.contentType
and.status
.I typed everything based on the current implementation and not
ECMA-419
(many modules are inconsistent with the published 2nd edition of the spec).