Replies: 1 comment
-
Closing as i’ve made progress on types (#1429) so the original reason for this discussion is resolved. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
(several edits since I first posted, all before any feedback)
I'm working on the typings for
embedded:network/websocket/client
, but it quickly devolved into needing to flush out other types. I have a few questions and likely will have more later, so it seemed appropriate to start a discussion.For
websocket/client
:onControl
interface is inconsistent with the ECMA-419 specification, as the implementation returns aUint8Array
but the specification says it should beArrayBuffer
. I would preferUint8Array
as the data is more immediately accessible but it's inconsistent with ECMA-419. Should this be changed toArrayBuffer
or should the spec change?network.ws.client
andnetwork.wss.client
with options on the "Host provider instance" (device
) but they are currently missing, instead being used asnetwork.ws
andnetwork.wss
. I've left it for now as implemented, but either the spec or the implementation should be updated.const
definitions and types for the codes themselves. Let me know if I can help.I've noticed that some
io
implementations do not use theembedded:xxx
namespace, and at least some do not conform to the 2nd ECMA-419 spec. For example,sntp
, which I was going to use but fell back on the legacy version for now since it didn't seem current. Am I correct in assuming I should ignore them if they are not part ofembedded:
and await updates? Or do you have advice on whichio
types are correct/current?I find error handling difficult to work with in
io
. MostonError
implementations have no error argument, making it difficult to diagnose failures. For example, I have a web socket getting an error during connection. I have no idea why or what module causing the error (since they cascade the error). The few places that implement an error argument use a string, rather than anError
object, which means there is no stack or attachments. Additionally, the strings themselves don't identify which module caused the error, are short, and are not necessarily unique. Not only does this make debugging difficult, it means I can't present any meaningful error to my users as to why something failed.I find the directory structure of
io
confusing. Thetypings
are fairly clean, but the implementations and examples are difficult to navigate. Some are inmodules
, some are inexamples
; some directory namespaces are significantly different than module namespace; it's not obvious which files in theexamples
set are test code vs. actual implementations. It would be great to clean up and unify the directory to be consistent with the namespace, and move core implementations into modules and out of examples.I'll be doing a PR soon for further discussion and review. I've adjusted
udp
,tcp
,tls
,dns
,websocket
, andbuiltin
- those thatwebsocket
depends upon - to be more comprehensive and usability. Similar work likely should be done on the other implemented types (I may do some of this before the PR). Some of the things I've done so far include:Device
into the global namespace, to pair withdevice
being global.Device
type when extended by modules, such aswebsocket/client
that addsnetwork
xxxDevice
type for several of the types that are the type used indevice
, to avoid the redundancy currently used to define these types. For example, you now import fromdns
aDNSUDPDevice
type, and can use it for any place wheredns
is used within theDevice
type (or when augmenting types)Beta Was this translation helpful? Give feedback.
All reactions