Skip to content
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

a simpler implementation of socket interface for different platform #71

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

qkang07
Copy link
Collaborator

@qkang07 qkang07 commented Apr 7, 2024

问题:

因为要优化 socket 连接问题,发现 socket 的抽象不太好。
之前使用了 SocketWrapper 来包装不同平台的 socket 实现。即使是 web 平台也把 WebSocket 包装了一层,完全没有必要。

解决方案:

把 SocketWrapper 抽象为接口,并且和浏览器的 WebSocket API 保持一致。其他平台来适配 WebSocket API,浏览器端保持不变。

其他

抽象了 EventEmitter,有很多地方用到。这次只应用在 MPSocket,其他地方后面再说。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant