@derivesome/sockets 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.package.json.~undo-tree~ +4 -2
  2. package/dist/cjs/server/app.d.ts +4 -0
  3. package/dist/cjs/server/app.d.ts.map +1 -1
  4. package/dist/cjs/server/app.js +27 -7
  5. package/dist/cjs/server/app.js.map +1 -1
  6. package/dist/cjs/server/connection.d.ts +7 -0
  7. package/dist/cjs/server/connection.d.ts.map +1 -0
  8. package/dist/cjs/server/connection.js +13 -0
  9. package/dist/cjs/server/connection.js.map +1 -0
  10. package/dist/cjs/server/events.d.ts +8 -8
  11. package/dist/cjs/server/events.d.ts.map +1 -1
  12. package/dist/cjs/socket.d.ts +11 -2
  13. package/dist/cjs/socket.d.ts.map +1 -1
  14. package/dist/cjs/socket.js +40 -15
  15. package/dist/cjs/socket.js.map +1 -1
  16. package/dist/esm/server/app.d.ts +4 -0
  17. package/dist/esm/server/app.d.ts.map +1 -1
  18. package/dist/esm/server/app.js +27 -7
  19. package/dist/esm/server/app.js.map +1 -1
  20. package/dist/esm/server/connection.d.ts +7 -0
  21. package/dist/esm/server/connection.d.ts.map +1 -0
  22. package/dist/esm/server/connection.js +9 -0
  23. package/dist/esm/server/connection.js.map +1 -0
  24. package/dist/esm/server/events.d.ts +8 -8
  25. package/dist/esm/server/events.d.ts.map +1 -1
  26. package/dist/esm/socket.d.ts +11 -2
  27. package/dist/esm/socket.d.ts.map +1 -1
  28. package/dist/esm/socket.js +40 -15
  29. package/dist/esm/socket.js.map +1 -1
  30. package/package.json +2 -1
  31. package/package.json~ +2 -1
  32. package/src/.socket.ts.~undo-tree~ +107 -2
  33. package/src/server/.app.test.ts.~undo-tree~ +3 -2
  34. package/src/server/.app.ts.~undo-tree~ +20 -2
  35. package/src/server/.connection.ts.~undo-tree~ +11 -0
  36. package/src/server/.events.ts.~undo-tree~ +16 -2
  37. package/src/server/app.test.ts +1 -1
  38. package/src/server/app.ts +29 -7
  39. package/src/server/app.ts~ +29 -8
  40. package/src/server/connection.ts +14 -0
  41. package/src/server/connection.ts~ +0 -0
  42. package/src/server/events.ts +8 -8
  43. package/src/server/events.ts~ +9 -14
  44. package/src/socket.ts +50 -15
  45. package/src/socket.ts~ +50 -15
@@ -1,5 +1,5 @@
1
1
  (undo-tree-save-format-version . 1)
2
- "486860ef795e24c99140d8793fc5bc110c310bf4"
2
+ "2d6e17c4fc13132795f9318cfe7e4d050cdf1218"
3
3
  [nil nil nil nil (27032 62999 441027 44000) 0 nil]
4
4
  ([nil nil ((69 . 76) (38 . 44) (#("r" 0 1 (font-lock-face web-mode-part-string-face part-token string part-side typescript)) . -38) (undo-tree-id474 . -1) (undo-tree-id475 . -1) (undo-tree-id476 . -1) (undo-tree-id477 . -1) (undo-tree-id478 . -1) (undo-tree-id479 . -1) (undo-tree-id480 . -1) (undo-tree-id481 . -1) (undo-tree-id482 . -1) (undo-tree-id483 . -1) (undo-tree-id484 . -1) (undo-tree-id485 . -1) (undo-tree-id486 . -1) (undo-tree-id487 . -1) (undo-tree-id488 . -1) (undo-tree-id489 . -1) (undo-tree-id490 . -1) (undo-tree-id491 . -1) (undo-tree-id492 . -1) (undo-tree-id493 . -1) (undo-tree-id494 . -1) (undo-tree-id495 . -1) (undo-tree-id496 . -1) (undo-tree-id497 . -1) (undo-tree-id498 . -1) (undo-tree-id499 . -1) (undo-tree-id500 . -1) (undo-tree-id501 . -1) (undo-tree-id502 . -1) (undo-tree-id503 . -1) (undo-tree-id504 . -1) (undo-tree-id505 . -1) (undo-tree-id506 . -1) (undo-tree-id507 . -1) (undo-tree-id508 . -1) (undo-tree-id509 . -1) (undo-tree-id510 . -1) (undo-tree-id511 . -1) (undo-tree-id512 . -1) (undo-tree-id513 . -1) (undo-tree-id514 . -1) (undo-tree-id515 . -1) (undo-tree-id516 . -1) (undo-tree-id517 . -1) (undo-tree-id518 . -1) (undo-tree-id519 . -1) (undo-tree-id520 . -1) (undo-tree-id521 . -1) (undo-tree-id522 . -1) (undo-tree-id523 . -1) (undo-tree-id524 . -1) (undo-tree-id525 . -1) (undo-tree-id526 . -1) (undo-tree-id527 . -1) (undo-tree-id528 . -1) (undo-tree-id529 . -1) (undo-tree-id530 . -1) (undo-tree-id531 . -1) (undo-tree-id532 . -1) (undo-tree-id533 . -1) (undo-tree-id534 . -1) (undo-tree-id535 . -1) (undo-tree-id536 . -1) (undo-tree-id537 . -1) (undo-tree-id538 . -1) (undo-tree-id539 . -1) (undo-tree-id540 . -1) (undo-tree-id541 . -1) (undo-tree-id542 . -1) (undo-tree-id543 . -1) (undo-tree-id544 . -1) (undo-tree-id545 . -1) (undo-tree-id546 . -1) (undo-tree-id547 . -1) (undo-tree-id548 . -1) (undo-tree-id549 . -1) (undo-tree-id550 . -1) (undo-tree-id551 . -1) (undo-tree-id552 . -1) (undo-tree-id553 . -1) (undo-tree-id554 . -1) (undo-tree-id555 . -1) (undo-tree-id556 . -1) (undo-tree-id557 . -1) (undo-tree-id558 . -1) (undo-tree-id559 . -1) (undo-tree-id560 . -1) (undo-tree-id561 . -1) (undo-tree-id562 . -1) (undo-tree-id563 . -1) (undo-tree-id564 . -1) (undo-tree-id565 . -1) (undo-tree-id566 . -1) (undo-tree-id567 . -1) (undo-tree-id568 . -1) (undo-tree-id569 . -1) (undo-tree-id570 . -1) (undo-tree-id571 . -1) (undo-tree-id572 . -1) (undo-tree-id573 . -1) (undo-tree-id574 . -1) (undo-tree-id575 . -1) (undo-tree-id576 . -1) (undo-tree-id577 . -1) (undo-tree-id578 . -1) (undo-tree-id579 . -1) (undo-tree-id580 . -1) (undo-tree-id581 . -1) (undo-tree-id582 . -1) (undo-tree-id583 . -1) (undo-tree-id584 . -1) (undo-tree-id585 . -1) (undo-tree-id586 . -1) (undo-tree-id587 . -1) (undo-tree-id588 . -1) (undo-tree-id589 . -1) (undo-tree-id590 . -1) (undo-tree-id591 . -1) (undo-tree-id592 . -1) (undo-tree-id593 . -1) (undo-tree-id594 . -1) (undo-tree-id595 . -1) (undo-tree-id596 . -1) (undo-tree-id597 . -1) (undo-tree-id598 . -1) (undo-tree-id599 . -1) (undo-tree-id600 . -1) (undo-tree-id601 . -1) (undo-tree-id602 . -1) (undo-tree-id603 . -1) (undo-tree-id604 . -1) (undo-tree-id605 . -1) (undo-tree-id606 . -1) (undo-tree-id607 . -1) (undo-tree-id608 . -1) (undo-tree-id609 . -1) (undo-tree-id610 . -1) (undo-tree-id611 . -1) (undo-tree-id612 . -1) (undo-tree-id613 . -1) (undo-tree-id614 . -1) (undo-tree-id615 . -1) (undo-tree-id616 . -1) (undo-tree-id617 . -1) (undo-tree-id618 . -1) (undo-tree-id619 . -1) (undo-tree-id620 . -1) (undo-tree-id621 . -1) (undo-tree-id622 . -1) (undo-tree-id623 . -1) (undo-tree-id624 . -1) (undo-tree-id625 . -1) (undo-tree-id626 . -1) (undo-tree-id627 . -1) (#("e" 0 1 (font-lock-face web-mode-part-string-face part-token string part-side typescript)) . -39) (undo-tree-id628 . -1) (undo-tree-id629 . -1) (undo-tree-id630 . -1) (undo-tree-id631 . -1) (undo-tree-id632 . -1) (undo-tree-id633 . -1) (undo-tree-id634 . -1) (undo-tree-id635 . -1) (undo-tree-id636 . -1) (undo-tree-id637 . -1) (undo-tree-id638 . -1) (undo-tree-id639 . -1) (undo-tree-id640 . -1) (undo-tree-id641 . -1) (undo-tree-id642 . -1) (undo-tree-id643 . -1) (undo-tree-id644 . -1) (undo-tree-id645 . -1) (undo-tree-id646 . -1) (undo-tree-id647 . -1) (undo-tree-id648 . -1) (undo-tree-id649 . -1) (undo-tree-id650 . -1) (undo-tree-id651 . -1) (undo-tree-id652 . -1) (undo-tree-id653 . -1) (undo-tree-id654 . -1) (undo-tree-id655 . -1) (undo-tree-id656 . -1) (undo-tree-id657 . -1) (undo-tree-id658 . -1) (undo-tree-id659 . -1) (undo-tree-id660 . -1) (undo-tree-id661 . -1) (undo-tree-id662 . -1) (undo-tree-id663 . -1) (undo-tree-id664 . -1) (undo-tree-id665 . -1) (undo-tree-id666 . -1) (undo-tree-id667 . -1) (undo-tree-id668 . -1) (undo-tree-id669 . -1) (undo-tree-id670 . -1) (undo-tree-id671 . -1) (undo-tree-id672 . -1) (undo-tree-id673 . -1) (undo-tree-id674 . -1) (undo-tree-id675 . -1) (undo-tree-id676 . -1) (undo-tree-id677 . -1) (undo-tree-id678 . -1) (undo-tree-id679 . -1) (undo-tree-id680 . -1) (undo-tree-id681 . -1) (undo-tree-id682 . -1) (undo-tree-id683 . -1) (undo-tree-id684 . -1) (undo-tree-id685 . -1) (undo-tree-id686 . -1) (undo-tree-id687 . -1) (undo-tree-id688 . -1) (undo-tree-id689 . -1) (undo-tree-id690 . -1) (undo-tree-id691 . -1) (undo-tree-id692 . -1) (undo-tree-id693 . -1) (undo-tree-id694 . -1) (undo-tree-id695 . -1) (undo-tree-id696 . -1) (undo-tree-id697 . -1) (undo-tree-id698 . -1) (undo-tree-id699 . -1) (undo-tree-id700 . -1) (undo-tree-id701 . -1) (undo-tree-id702 . -1) (undo-tree-id703 . -1) (undo-tree-id704 . -1) (undo-tree-id705 . -1) (undo-tree-id706 . -1) (undo-tree-id707 . -1) (undo-tree-id708 . -1) (undo-tree-id709 . -1) (undo-tree-id710 . -1) (undo-tree-id711 . -1) (undo-tree-id712 . -1) (undo-tree-id713 . -1) (undo-tree-id714 . -1) (undo-tree-id715 . -1) (undo-tree-id716 . -1) (undo-tree-id717 . -1) (undo-tree-id718 . -1) (undo-tree-id719 . -1) (undo-tree-id720 . -1) (undo-tree-id721 . -1) (undo-tree-id722 . -1) (undo-tree-id723 . -1) (undo-tree-id724 . -1) (undo-tree-id725 . -1) (undo-tree-id726 . -1) (undo-tree-id727 . -1) (undo-tree-id728 . -1) (undo-tree-id729 . -1) (undo-tree-id730 . -1) (undo-tree-id731 . -1) (undo-tree-id732 . -1) (undo-tree-id733 . -1) (undo-tree-id734 . -1) (undo-tree-id735 . -1) (undo-tree-id736 . -1) (undo-tree-id737 . -1) (undo-tree-id738 . -1) (undo-tree-id739 . -1) (undo-tree-id740 . -1) (undo-tree-id741 . -1) (undo-tree-id742 . -1) (undo-tree-id743 . -1) (undo-tree-id744 . -1) (undo-tree-id745 . -1) (undo-tree-id746 . -1) (undo-tree-id747 . -1) (undo-tree-id748 . -1) (undo-tree-id749 . -1) (undo-tree-id750 . -1) (undo-tree-id751 . -1) (undo-tree-id752 . -1) (undo-tree-id753 . -1) (undo-tree-id754 . -1) (undo-tree-id755 . -1) (undo-tree-id756 . -1) (undo-tree-id757 . -1) (undo-tree-id758 . -1) (undo-tree-id759 . -1) (undo-tree-id760 . -1) (undo-tree-id761 . -1) (#("c" 0 1 (font-lock-face web-mode-part-string-face part-token string part-side typescript)) . -40) (undo-tree-id762 . -1) (undo-tree-id763 . -1) (undo-tree-id764 . -1) (undo-tree-id765 . -1) (undo-tree-id766 . -1) (undo-tree-id767 . -1) (undo-tree-id768 . -1) (undo-tree-id769 . -1) (undo-tree-id770 . -1) (undo-tree-id771 . -1) (undo-tree-id772 . -1) (undo-tree-id773 . -1) (undo-tree-id774 . -1) (undo-tree-id775 . -1) (undo-tree-id776 . -1) (undo-tree-id777 . -1) (undo-tree-id778 . -1) (undo-tree-id779 . -1) (undo-tree-id780 . -1) (undo-tree-id781 . -1) (undo-tree-id782 . -1) (undo-tree-id783 . -1) (undo-tree-id784 . -1) (undo-tree-id785 . -1) (undo-tree-id786 . -1) (undo-tree-id787 . -1) (undo-tree-id788 . -1) (undo-tree-id789 . -1) (undo-tree-id790 . -1) (undo-tree-id791 . -1) (undo-tree-id792 . -1) (undo-tree-id793 . -1) (undo-tree-id794 . -1) (undo-tree-id795 . -1) (undo-tree-id796 . -1) (undo-tree-id797 . -1) (undo-tree-id798 . -1) (undo-tree-id799 . -1) (undo-tree-id800 . -1) (undo-tree-id801 . -1) (undo-tree-id802 . -1) (undo-tree-id803 . -1) (undo-tree-id804 . -1) (undo-tree-id805 . -1) (undo-tree-id806 . -1) (undo-tree-id807 . -1) (undo-tree-id808 . -1) (undo-tree-id809 . -1) (undo-tree-id810 . -1) (undo-tree-id811 . -1) (undo-tree-id812 . -1) (undo-tree-id813 . -1) (undo-tree-id814 . -1) (undo-tree-id815 . -1) (undo-tree-id816 . -1) (undo-tree-id817 . -1) (undo-tree-id818 . -1) (undo-tree-id819 . -1) (undo-tree-id820 . -1) (undo-tree-id821 . -1) (undo-tree-id822 . -1) (undo-tree-id823 . -1) (undo-tree-id824 . -1) (undo-tree-id825 . -1) (undo-tree-id826 . -1) (undo-tree-id827 . -1) (undo-tree-id828 . -1) (undo-tree-id829 . -1) (undo-tree-id830 . -1) (undo-tree-id831 . -1) (undo-tree-id832 . -1) (undo-tree-id833 . -1) (undo-tree-id834 . -1) (undo-tree-id835 . -1) (undo-tree-id836 . -1) (undo-tree-id837 . -1) (undo-tree-id838 . -1) (undo-tree-id839 . -1) (undo-tree-id840 . -1) (undo-tree-id841 . -1) (undo-tree-id842 . -1) (undo-tree-id843 . -1) (undo-tree-id844 . -1) (undo-tree-id845 . -1) (undo-tree-id846 . -1) (undo-tree-id847 . -1) (undo-tree-id848 . -1) (undo-tree-id849 . -1) (undo-tree-id850 . -1) (undo-tree-id851 . -1) (undo-tree-id852 . -1) (undo-tree-id853 . -1) (undo-tree-id854 . -1) (undo-tree-id855 . -1) (undo-tree-id856 . -1) (undo-tree-id857 . -1) (undo-tree-id858 . -1) (undo-tree-id859 . -1) (undo-tree-id860 . -1) (undo-tree-id861 . -1) (undo-tree-id862 . -1) (undo-tree-id863 . -1) (undo-tree-id864 . -1) (undo-tree-id865 . -1) (undo-tree-id866 . -1) (undo-tree-id867 . -1) (undo-tree-id868 . -1) (undo-tree-id869 . -1) (undo-tree-id870 . -1) (undo-tree-id871 . -1) (undo-tree-id872 . -1) (undo-tree-id873 . -1) (undo-tree-id874 . -1) (undo-tree-id875 . -1) (undo-tree-id876 . -1) (undo-tree-id877 . -1) (undo-tree-id878 . -1) (undo-tree-id879 . -1) (undo-tree-id880 . -1) (#("e" 0 1 (font-lock-face web-mode-part-string-face part-token string part-side typescript)) . -41) (undo-tree-id881 . -1) (undo-tree-id882 . -1) (undo-tree-id883 . -1) (undo-tree-id884 . -1) (undo-tree-id885 . -1) (undo-tree-id886 . -1) (undo-tree-id887 . -1) (undo-tree-id888 . -1) (undo-tree-id889 . -1) (undo-tree-id890 . -1) (undo-tree-id891 . -1) (undo-tree-id892 . -1) (undo-tree-id893 . -1) (undo-tree-id894 . -1) (undo-tree-id895 . -1) (undo-tree-id896 . -1) (undo-tree-id897 . -1) (undo-tree-id898 . -1) (undo-tree-id899 . -1) (undo-tree-id900 . -1) (undo-tree-id901 . -1) (undo-tree-id902 . -1) (undo-tree-id903 . -1) (undo-tree-id904 . -1) (undo-tree-id905 . -1) (undo-tree-id906 . -1) (undo-tree-id907 . -1) (undo-tree-id908 . -1) (undo-tree-id909 . -1) (undo-tree-id910 . -1) (undo-tree-id911 . -1) (undo-tree-id912 . -1) (undo-tree-id913 . -1) (undo-tree-id914 . -1) (undo-tree-id915 . -1) (undo-tree-id916 . -1) (undo-tree-id917 . -1) (undo-tree-id918 . -1) (undo-tree-id919 . -1) (undo-tree-id920 . -1) (undo-tree-id921 . -1) (undo-tree-id922 . -1) (undo-tree-id923 . -1) (undo-tree-id924 . -1) (undo-tree-id925 . -1) (undo-tree-id926 . -1) (undo-tree-id927 . -1) (undo-tree-id928 . -1) (undo-tree-id929 . -1) (undo-tree-id930 . -1) (undo-tree-id931 . -1) (undo-tree-id932 . -1) (undo-tree-id933 . -1) (undo-tree-id934 . -1) (undo-tree-id935 . -1) (undo-tree-id936 . -1) (undo-tree-id937 . -1) (undo-tree-id938 . -1) (undo-tree-id939 . -1) (undo-tree-id940 . -1) (undo-tree-id941 . -1) (undo-tree-id942 . -1) (undo-tree-id943 . -1) (undo-tree-id944 . -1) (undo-tree-id945 . -1) (undo-tree-id946 . -1) (undo-tree-id947 . -1) (undo-tree-id948 . -1) (undo-tree-id949 . -1) (undo-tree-id950 . -1) (undo-tree-id951 . -1) (undo-tree-id952 . -1) (undo-tree-id953 . -1) (undo-tree-id954 . -1) (undo-tree-id955 . -1) (undo-tree-id956 . -1) (undo-tree-id957 . -1) (undo-tree-id958 . -1) (undo-tree-id959 . -1) (undo-tree-id960 . -1) (undo-tree-id961 . -1) (undo-tree-id962 . -1) (undo-tree-id963 . -1) (undo-tree-id964 . -1) (undo-tree-id965 . -1) (undo-tree-id966 . -1) (undo-tree-id967 . -1) (undo-tree-id968 . -1) (undo-tree-id969 . -1) (undo-tree-id970 . -1) (undo-tree-id971 . -1) (undo-tree-id972 . -1) (undo-tree-id973 . -1) (undo-tree-id974 . -1) (undo-tree-id975 . -1) (undo-tree-id976 . -1) (undo-tree-id977 . -1) (undo-tree-id978 . -1) (undo-tree-id979 . -1) (undo-tree-id980 . -1) (undo-tree-id981 . -1) (undo-tree-id982 . -1) (undo-tree-id983 . -1) (undo-tree-id984 . -1) (#("i" 0 1 (font-lock-face web-mode-part-string-face part-token string part-side typescript)) . -42) (undo-tree-id985 . -1) (undo-tree-id986 . -1) (undo-tree-id987 . -1) (undo-tree-id988 . -1) (undo-tree-id989 . -1) (undo-tree-id990 . -1) (undo-tree-id991 . -1) (undo-tree-id992 . -1) (undo-tree-id993 . -1) (undo-tree-id994 . -1) (undo-tree-id995 . -1) (undo-tree-id996 . -1) (undo-tree-id997 . -1) (undo-tree-id998 . -1) (undo-tree-id999 . -1) (undo-tree-id1000 . -1) (undo-tree-id1001 . -1) (undo-tree-id1002 . -1) (undo-tree-id1003 . -1) (undo-tree-id1004 . -1) (undo-tree-id1005 . -1) (undo-tree-id1006 . -1) (undo-tree-id1007 . -1) (undo-tree-id1008 . -1) (undo-tree-id1009 . -1) (undo-tree-id1010 . -1) (undo-tree-id1011 . -1) (undo-tree-id1012 . -1) (undo-tree-id1013 . -1) (undo-tree-id1014 . -1) (undo-tree-id1015 . -1) (undo-tree-id1016 . -1) (undo-tree-id1017 . -1) (undo-tree-id1018 . -1) (undo-tree-id1019 . -1) (undo-tree-id1020 . -1) (undo-tree-id1021 . -1) (undo-tree-id1022 . -1) (undo-tree-id1023 . -1) (undo-tree-id1024 . -1) (undo-tree-id1025 . -1) (undo-tree-id1026 . -1) (undo-tree-id1027 . -1) (undo-tree-id1028 . -1) (undo-tree-id1029 . -1) (undo-tree-id1030 . -1) (undo-tree-id1031 . -1) (undo-tree-id1032 . -1) (undo-tree-id1033 . -1) (undo-tree-id1034 . -1) (undo-tree-id1035 . -1) (undo-tree-id1036 . -1) (undo-tree-id1037 . -1) (undo-tree-id1038 . -1) (undo-tree-id1039 . -1) (undo-tree-id1040 . -1) (undo-tree-id1041 . -1) (undo-tree-id1042 . -1) (undo-tree-id1043 . -1) (undo-tree-id1044 . -1) (undo-tree-id1045 . -1) (undo-tree-id1046 . -1) (undo-tree-id1047 . -1) (undo-tree-id1048 . -1) (undo-tree-id1049 . -1) (undo-tree-id1050 . -1) (undo-tree-id1051 . -1) (undo-tree-id1052 . -1) (undo-tree-id1053 . -1) (undo-tree-id1054 . -1) (undo-tree-id1055 . -1) (undo-tree-id1056 . -1) (undo-tree-id1057 . -1) (undo-tree-id1058 . -1) (undo-tree-id1059 . -1) (undo-tree-id1060 . -1) (undo-tree-id1061 . -1) (undo-tree-id1062 . -1) (undo-tree-id1063 . -1) (undo-tree-id1064 . -1) (undo-tree-id1065 . -1) (undo-tree-id1066 . -1) (undo-tree-id1067 . -1) (undo-tree-id1068 . -1) (undo-tree-id1069 . -1) (undo-tree-id1070 . -1) (undo-tree-id1071 . -1) (undo-tree-id1072 . -1) (undo-tree-id1073 . -1) (#("v" 0 1 (font-lock-face web-mode-part-string-face part-token string part-side typescript)) . -43) (undo-tree-id1074 . -1) (undo-tree-id1075 . -1) (undo-tree-id1076 . -1) (undo-tree-id1077 . -1) (undo-tree-id1078 . -1) (undo-tree-id1079 . -1) (undo-tree-id1080 . -1) (undo-tree-id1081 . -1) (undo-tree-id1082 . -1) (undo-tree-id1083 . -1) (undo-tree-id1084 . -1) (undo-tree-id1085 . -1) (undo-tree-id1086 . -1) (undo-tree-id1087 . -1) (undo-tree-id1088 . -1) (undo-tree-id1089 . -1) (undo-tree-id1090 . -1) (undo-tree-id1091 . -1) (undo-tree-id1092 . -1) (undo-tree-id1093 . -1) (undo-tree-id1094 . -1) (undo-tree-id1095 . -1) (undo-tree-id1096 . -1) (undo-tree-id1097 . -1) (undo-tree-id1098 . -1) (undo-tree-id1099 . -1) (undo-tree-id1100 . -1) (undo-tree-id1101 . -1) (undo-tree-id1102 . -1) (undo-tree-id1103 . -1) (undo-tree-id1104 . -1) (undo-tree-id1105 . -1) (undo-tree-id1106 . -1) (undo-tree-id1107 . -1) (undo-tree-id1108 . -1) (undo-tree-id1109 . -1) (undo-tree-id1110 . -1) (undo-tree-id1111 . -1) (undo-tree-id1112 . -1) (undo-tree-id1113 . -1) (undo-tree-id1114 . -1) (undo-tree-id1115 . -1) (undo-tree-id1116 . -1) (undo-tree-id1117 . -1) (undo-tree-id1118 . -1) (undo-tree-id1119 . -1) (undo-tree-id1120 . -1) (undo-tree-id1121 . -1) (undo-tree-id1122 . -1) (undo-tree-id1123 . -1) (undo-tree-id1124 . -1) (undo-tree-id1125 . -1) (undo-tree-id1126 . -1) (undo-tree-id1127 . -1) (undo-tree-id1128 . -1) (undo-tree-id1129 . -1) (undo-tree-id1130 . -1) (undo-tree-id1131 . -1) (undo-tree-id1132 . -1) (undo-tree-id1133 . -1) (undo-tree-id1134 . -1) (undo-tree-id1135 . -1) (undo-tree-id1136 . -1) (undo-tree-id1137 . -1) (undo-tree-id1138 . -1) (undo-tree-id1139 . -1) (undo-tree-id1140 . -1) (undo-tree-id1141 . -1) (undo-tree-id1142 . -1) (undo-tree-id1143 . -1) (undo-tree-id1144 . -1) (undo-tree-id1145 . -1) (undo-tree-id1146 . -1) (undo-tree-id1147 . -1) (#("e" 0 1 (font-lock-face web-mode-part-string-face part-token string part-side typescript)) . -44) (undo-tree-id1148 . -1) (undo-tree-id1149 . -1) (undo-tree-id1150 . -1) (undo-tree-id1151 . -1) (undo-tree-id1152 . -1) (undo-tree-id1153 . -1) (undo-tree-id1154 . -1) (undo-tree-id1155 . -1) (undo-tree-id1156 . -1) (undo-tree-id1157 . -1) (undo-tree-id1158 . -1) (undo-tree-id1159 . -1) (undo-tree-id1160 . -1) (undo-tree-id1161 . -1) (undo-tree-id1162 . -1) (undo-tree-id1163 . -1) (undo-tree-id1164 . -1) (undo-tree-id1165 . -1) (undo-tree-id1166 . -1) (undo-tree-id1167 . -1) (undo-tree-id1168 . -1) (undo-tree-id1169 . -1) (undo-tree-id1170 . -1) (undo-tree-id1171 . -1) (undo-tree-id1172 . -1) (undo-tree-id1173 . -1) (undo-tree-id1174 . -1) (undo-tree-id1175 . -1) (undo-tree-id1176 . -1) (undo-tree-id1177 . -1) (undo-tree-id1178 . -1) (undo-tree-id1179 . -1) (undo-tree-id1180 . -1) (undo-tree-id1181 . -1) (undo-tree-id1182 . -1) (undo-tree-id1183 . -1) (undo-tree-id1184 . -1) (undo-tree-id1185 . -1) (undo-tree-id1186 . -1) (undo-tree-id1187 . -1) (undo-tree-id1188 . -1) (undo-tree-id1189 . -1) (undo-tree-id1190 . -1) (undo-tree-id1191 . -1) (undo-tree-id1192 . -1) (undo-tree-id1193 . -1) (undo-tree-id1194 . -1) (undo-tree-id1195 . -1) (undo-tree-id1196 . -1) (undo-tree-id1197 . -1) (undo-tree-id1198 . -1) (undo-tree-id1199 . -1) (undo-tree-id1200 . -1) (undo-tree-id1201 . -1) (undo-tree-id1202 . -1) (undo-tree-id1203 . -1) (undo-tree-id1204 . -1) (#("d" 0 1 (font-lock-face web-mode-part-string-face part-token string part-side typescript)) . -45) (undo-tree-id1205 . -1) (undo-tree-id1206 . -1) (undo-tree-id1207 . -1) (undo-tree-id1208 . -1) (undo-tree-id1209 . -1) (undo-tree-id1210 . -1) (undo-tree-id1211 . -1) (undo-tree-id1212 . -1) (undo-tree-id1213 . -1) (undo-tree-id1214 . -1) (undo-tree-id1215 . -1) (undo-tree-id1216 . -1) (undo-tree-id1217 . -1) (undo-tree-id1218 . -1) (undo-tree-id1219 . -1) (undo-tree-id1220 . -1) (undo-tree-id1221 . -1) (undo-tree-id1222 . -1) (undo-tree-id1223 . -1) (undo-tree-id1224 . -1) (undo-tree-id1225 . -1) (undo-tree-id1226 . -1) (undo-tree-id1227 . -1) (undo-tree-id1228 . -1) (undo-tree-id1229 . -1) (undo-tree-id1230 . -1) (undo-tree-id1231 . -1) (undo-tree-id1232 . -1) (undo-tree-id1233 . -1) (undo-tree-id1234 . -1) (undo-tree-id1235 . -1) (undo-tree-id1236 . -1) 46 (93 . 100) (144 . 146) (137 . 145) (135 . 137) (#(" " 0 2 (part-side typescript)) . 135) (135 . 137) (134 . 136) (#("}" 0 1 (part-side typescript)) . -134) (134 . 135) (#("}" 0 1 (part-side typescript)) . -134) (134 . 135) (130 . 135) (120 . 127) (113 . 121) (111 . 113) (#(" " 0 2 (part-side typescript)) . 111) (111 . 113) (110 . 112) (#("}" 0 1 (part-side typescript)) . -110) (110 . 111) (#("}" 0 1 (part-side typescript)) . -110) (110 . 111) (106 . 111) (88 . 90) (#("e" 0 1 (face web-mode-variable-name-face part-side typescript)) . -88) (undo-tree-id1237 . -1) (#("p" 0 1 (face web-mode-variable-name-face part-side typescript)) . -89) (undo-tree-id1238 . -1) (#("e" 0 1 (face web-mode-variable-name-face part-side typescript)) . -90) (undo-tree-id1239 . -1) 91 (100 . 104) (94 . 100) (89 . 95) (#("p" 0 1 (part-side typescript)) . -89) (undo-tree-id1240 . -1) 90 (86 . 90) (84 . 86) (#(" " 0 2 (part-side typescript)) . 84) (84 . 86) (83 . 85) (#("}" 0 1 (part-side typescript)) . -83) (83 . 84) (#("}" 0 1 (part-side typescript)) . -83) (83 . 84) (79 . 84) (71 . 76) (64 . 72) (62 . 64) (#(" " 0 2 (part-side typescript)) . 62) (62 . 64) (61 . 63) (#("}" 0 1 (part-side typescript)) . -61) (61 . 62) (#("}" 0 1 (part-side typescript)) . -61) (61 . 62) (57 . 62) (#("," 0 1 (part-side typescript)) . -55) (undo-tree-id1241 . -1) (undo-tree-id1242 . -1) (undo-tree-id1243 . -1) (undo-tree-id1244 . -1) (undo-tree-id1245 . -1) 56 (55 . 56) (38 . 54) (31 . 39) (29 . 31) (#(" " 0 2 (part-side typescript)) . 29) (29 . 31) (28 . 30) (#("}" 0 1 (part-side typescript)) . -28) (28 . 29) (#("}" 0 1 (part-side typescript)) . -28) (28 . 29) (24 . 29) (#("M" 0 1 (part-side typescript)) . -24) (undo-tree-id1246 . -1) (#("a" 0 1 (part-side typescript)) . -25) (undo-tree-id1247 . -1) (#("p" 0 1 (part-side typescript)) . -26) (undo-tree-id1248 . -1) 27 (#(" " 0 1 (part-side typescript)) . -27) (undo-tree-id1249 . -1) (#("=" 0 1 (part-side typescript)) . -28) (undo-tree-id1250 . -1) (#(" " 0 1 (part-side typescript)) . -29) (undo-tree-id1251 . -1) (#("{" 0 1 (part-side typescript)) . -30) (undo-tree-id1252 . -1) (#("
5
5
  " 0 1 (part-side typescript)) . -31) (undo-tree-id1253 . -1) (#(" " 0 1 (part-side typescript)) . -32) (undo-tree-id1254 . -1) (#(" " 0 1 (part-side typescript)) . -33) (undo-tree-id1255 . -1) (#("
@@ -244,5 +244,19 @@ export type ServerEvent =
244
244
  ([nil nil ((288 . 299) (278 . 283) (276 . 283) (t 27033 2284 422288 507000)) nil (27033 2319 579577 69000) 0 nil])
245
245
  ([nil nil ((#("WebSocket.Event" 0 15 (part-side typescript invisible nil)) . 1151) (undo-tree-id475 . -14) (undo-tree-id476 . -14) (undo-tree-id477 . -14) (undo-tree-id478 . -3) (undo-tree-id479 . -3) (undo-tree-id480 . -3) (undo-tree-id481 . -3) (undo-tree-id482 . -3) (undo-tree-id483 . -3) (undo-tree-id484 . -3) (undo-tree-id485 . -3) (undo-tree-id486 . -3) (undo-tree-id487 . -3) (undo-tree-id488 . -3) (undo-tree-id489 . -3) (undo-tree-id490 . -3) (undo-tree-id491 . -3) (undo-tree-id492 . -3) (undo-tree-id493 . -3) (undo-tree-id494 . -3) (undo-tree-id495 . -3) (undo-tree-id496 . -3) (undo-tree-id497 . -3) (undo-tree-id498 . -3) (undo-tree-id499 . -3) (undo-tree-id500 . -3) (undo-tree-id501 . -3) (undo-tree-id502 . -3) (undo-tree-id503 . -15) (undo-tree-id504 . -15) (undo-tree-id505 . -15) (undo-tree-id506 . -15) (undo-tree-id507 . -15) (undo-tree-id508 . -15) (undo-tree-id509 . -15) (undo-tree-id510 . -15) (undo-tree-id511 . -15) (undo-tree-id512 . -15) (undo-tree-id513 . -14) (undo-tree-id514 . -14) (undo-tree-id515 . -14) (undo-tree-id516 . -14) (undo-tree-id517 . -14) (undo-tree-id518 . -14) (undo-tree-id519 . -14) (undo-tree-id520 . -14) (undo-tree-id521 . -14) (undo-tree-id522 . -14) (undo-tree-id523 . -14) (undo-tree-id524 . -14) (undo-tree-id525 . -14) (undo-tree-id526 . -14) (undo-tree-id527 . -14) (undo-tree-id528 . -14) (undo-tree-id529 . -14) (undo-tree-id530 . -14) (undo-tree-id531 . -14) (undo-tree-id532 . -14) (undo-tree-id533 . -14) (undo-tree-id534 . -14) (undo-tree-id535 . -14) (undo-tree-id536 . -14) (undo-tree-id537 . -14) (undo-tree-id538 . -14) (undo-tree-id539 . -14) (undo-tree-id540 . -14) (undo-tree-id541 . -14) (undo-tree-id542 . -14) (undo-tree-id543 . -14) (undo-tree-id544 . -14) (undo-tree-id545 . -14) (undo-tree-id546 . -14) (undo-tree-id547 . -14) (undo-tree-id548 . -14) (undo-tree-id549 . -14) (undo-tree-id550 . -14) (undo-tree-id551 . -14) (undo-tree-id552 . -14) (undo-tree-id553 . -14) (undo-tree-id554 . -14) (undo-tree-id555 . -15) (undo-tree-id556 . -15)) nil (27033 2319 579575 654000) 0 nil])
246
246
  ([nil nil ((1151 . 1158)) nil (27033 2319 579532 407000) 0 nil])
247
- ([nil current ((#("type WebSocket, " 0 4 (face web-mode-keyword-face part-side typescript invisible nil) 4 14 (part-side typescript invisible nil) 14 16 (part-side typescript invisible nil)) . 107) (undo-tree-id557 . -15) (undo-tree-id558 . -15) (undo-tree-id559 . -15) (undo-tree-id560 . -14) (undo-tree-id561 . -14) (undo-tree-id562 . -14) (undo-tree-id563 . -14) (undo-tree-id564 . -16) (undo-tree-id565 . -16) (undo-tree-id566 . -16) (undo-tree-id567 . -16) (undo-tree-id568 . -16) (undo-tree-id569 . -16) (undo-tree-id570 . -16) (undo-tree-id571 . -16) (undo-tree-id572 . -16) (undo-tree-id573 . -16) (undo-tree-id574 . -15) (undo-tree-id575 . -15) (undo-tree-id576 . -15) (undo-tree-id577 . -15) (undo-tree-id578 . -15) (undo-tree-id579 . -15) (undo-tree-id580 . -15) (undo-tree-id581 . -15) (undo-tree-id582 . -15) (undo-tree-id583 . -15) (undo-tree-id584 . -15) (undo-tree-id585 . -15) (undo-tree-id586 . -15) (undo-tree-id587 . -15) (undo-tree-id588 . -15) (undo-tree-id589 . -15) (undo-tree-id590 . -15) (undo-tree-id591 . -15) (undo-tree-id592 . -15) (undo-tree-id593 . -15) (undo-tree-id594 . -15) (undo-tree-id595 . -15) (undo-tree-id596 . -15) (undo-tree-id597 . -15) (undo-tree-id598 . -15) (undo-tree-id599 . -15) (undo-tree-id600 . -15) (undo-tree-id601 . -15) (undo-tree-id602 . -15) (undo-tree-id603 . -15) (undo-tree-id604 . -15) (undo-tree-id605 . -15) (undo-tree-id606 . -15) (undo-tree-id607 . -15) (undo-tree-id608 . -15) (undo-tree-id609 . -15) (undo-tree-id610 . -15) (undo-tree-id611 . -15) (undo-tree-id612 . -15) (undo-tree-id613 . -15) (undo-tree-id614 . -15) (undo-tree-id615 . -15) (undo-tree-id616 . -15) (undo-tree-id617 . -15) (undo-tree-id618 . -15) (undo-tree-id619 . -15) (undo-tree-id620 . -15) (undo-tree-id621 . -15) (undo-tree-id622 . -15) (undo-tree-id623 . -15) (undo-tree-id624 . -15) (undo-tree-id625 . -15) (undo-tree-id626 . -15) (undo-tree-id627 . -15) (undo-tree-id628 . -15) (undo-tree-id629 . -15) (undo-tree-id630 . -15) (undo-tree-id631 . -15) (undo-tree-id632 . -15) (undo-tree-id633 . -15) (undo-tree-id634 . -15) (undo-tree-id635 . -15) (undo-tree-id636 . -15) (undo-tree-id637 . -15) (undo-tree-id638 . -15) (undo-tree-id639 . -15) (undo-tree-id640 . -15) (undo-tree-id641 . -15) (undo-tree-id642 . -15) (undo-tree-id643 . -15) (undo-tree-id644 . -15) (undo-tree-id645 . -15) (undo-tree-id646 . -15) (undo-tree-id647 . -15) (undo-tree-id648 . -15) (undo-tree-id649 . -15) (undo-tree-id650 . -15) (undo-tree-id651 . -15) (undo-tree-id652 . -15) (undo-tree-id653 . -15) (undo-tree-id654 . -15) (undo-tree-id655 . -15) (undo-tree-id656 . -15) (undo-tree-id657 . -15) (undo-tree-id658 . -15) (undo-tree-id659 . -15) (undo-tree-id660 . -15) (undo-tree-id661 . -15) (undo-tree-id662 . -15) (undo-tree-id663 . -15) (undo-tree-id664 . -15) (undo-tree-id665 . -15) (undo-tree-id666 . -15) (undo-tree-id667 . -15) (undo-tree-id668 . -15) (undo-tree-id669 . -15) (undo-tree-id670 . -15) (undo-tree-id671 . -15) (undo-tree-id672 . -15) (undo-tree-id673 . -15) (undo-tree-id674 . -15) (undo-tree-id675 . -15) (undo-tree-id676 . -15) (undo-tree-id677 . -15) (undo-tree-id678 . -15) (undo-tree-id679 . -15) (undo-tree-id680 . -15) (undo-tree-id681 . -15) (undo-tree-id682 . -15) (undo-tree-id683 . -15) (undo-tree-id684 . -15) (undo-tree-id685 . -15) (undo-tree-id686 . -15) (undo-tree-id687 . -15) (undo-tree-id688 . -15) (undo-tree-id689 . -15) (undo-tree-id690 . -15) (undo-tree-id691 . -15) (undo-tree-id692 . -15) (undo-tree-id693 . -15) (undo-tree-id694 . -15) (undo-tree-id695 . -15) (undo-tree-id696 . -15) (undo-tree-id697 . -15) (undo-tree-id698 . -15) (undo-tree-id699 . -15) (undo-tree-id700 . -15) (undo-tree-id701 . -15) (undo-tree-id702 . -15) (undo-tree-id703 . -15) (undo-tree-id704 . -15) (undo-tree-id705 . -15) (undo-tree-id706 . -15) (undo-tree-id707 . -15) (undo-tree-id708 . -15) (undo-tree-id709 . -15) (undo-tree-id710 . -15) (undo-tree-id711 . -15) (undo-tree-id712 . -15) (undo-tree-id713 . -15) (undo-tree-id714 . -15) (undo-tree-id715 . -15) (undo-tree-id716 . -15) (undo-tree-id717 . -15) (undo-tree-id718 . -15) (undo-tree-id719 . -15) (undo-tree-id720 . -15) (undo-tree-id721 . -15) (undo-tree-id722 . -15) (undo-tree-id723 . -15) (undo-tree-id724 . -15) (undo-tree-id725 . -15) (undo-tree-id726 . -15) (undo-tree-id727 . -15) (undo-tree-id728 . -15) (undo-tree-id729 . -15) (undo-tree-id730 . -15) (undo-tree-id731 . -15) (undo-tree-id732 . -15) (undo-tree-id733 . -15) (undo-tree-id734 . -15) (undo-tree-id735 . -15) (undo-tree-id736 . -15) (undo-tree-id737 . -15) (undo-tree-id738 . -15) (undo-tree-id739 . -15) (undo-tree-id740 . -15) (undo-tree-id741 . -15) (undo-tree-id742 . -15) (undo-tree-id743 . -15) (undo-tree-id744 . -15) (undo-tree-id745 . -15) (undo-tree-id746 . -15) (undo-tree-id747 . -15) (undo-tree-id748 . -15) (undo-tree-id749 . -15) (undo-tree-id750 . -15) (undo-tree-id751 . -15) (undo-tree-id752 . -15) (undo-tree-id753 . -15) (undo-tree-id754 . -15) (undo-tree-id755 . -5) (undo-tree-id756 . -5) (undo-tree-id757 . -5) (undo-tree-id758 . -5) (undo-tree-id759 . -5) (undo-tree-id760 . -5) (undo-tree-id761 . -5) (undo-tree-id762 . -5) (undo-tree-id763 . -5) (undo-tree-id764 . -5) (undo-tree-id765 . -5) (undo-tree-id766 . -5) (undo-tree-id767 . -5) (undo-tree-id768 . -5) (undo-tree-id769 . -5) (undo-tree-id770 . -5) (undo-tree-id771 . -5) (undo-tree-id772 . -5) (undo-tree-id773 . -5) (undo-tree-id774 . -5) (undo-tree-id775 . -5) (undo-tree-id776 . -5) (undo-tree-id777 . -16) (undo-tree-id778 . -16) (t 27033 2320 781934 33000)) nil (27033 2343 168837 295000) 0 nil])
247
+ ([nil nil ((#("type WebSocket, " 0 4 (face web-mode-keyword-face part-side typescript invisible nil) 4 14 (part-side typescript invisible nil) 14 16 (part-side typescript invisible nil)) . 107) (undo-tree-id557 . -15) (undo-tree-id558 . -15) (undo-tree-id559 . -15) (undo-tree-id560 . -14) (undo-tree-id561 . -14) (undo-tree-id562 . -14) (undo-tree-id563 . -14) (undo-tree-id564 . -16) (undo-tree-id565 . -16) (undo-tree-id566 . -16) (undo-tree-id567 . -16) (undo-tree-id568 . -16) (undo-tree-id569 . -16) (undo-tree-id570 . -16) (undo-tree-id571 . -16) (undo-tree-id572 . -16) (undo-tree-id573 . -16) (undo-tree-id574 . -15) (undo-tree-id575 . -15) (undo-tree-id576 . -15) (undo-tree-id577 . -15) (undo-tree-id578 . -15) (undo-tree-id579 . -15) (undo-tree-id580 . -15) (undo-tree-id581 . -15) (undo-tree-id582 . -15) (undo-tree-id583 . -15) (undo-tree-id584 . -15) (undo-tree-id585 . -15) (undo-tree-id586 . -15) (undo-tree-id587 . -15) (undo-tree-id588 . -15) (undo-tree-id589 . -15) (undo-tree-id590 . -15) (undo-tree-id591 . -15) (undo-tree-id592 . -15) (undo-tree-id593 . -15) (undo-tree-id594 . -15) (undo-tree-id595 . -15) (undo-tree-id596 . -15) (undo-tree-id597 . -15) (undo-tree-id598 . -15) (undo-tree-id599 . -15) (undo-tree-id600 . -15) (undo-tree-id601 . -15) (undo-tree-id602 . -15) (undo-tree-id603 . -15) (undo-tree-id604 . -15) (undo-tree-id605 . -15) (undo-tree-id606 . -15) (undo-tree-id607 . -15) (undo-tree-id608 . -15) (undo-tree-id609 . -15) (undo-tree-id610 . -15) (undo-tree-id611 . -15) (undo-tree-id612 . -15) (undo-tree-id613 . -15) (undo-tree-id614 . -15) (undo-tree-id615 . -15) (undo-tree-id616 . -15) (undo-tree-id617 . -15) (undo-tree-id618 . -15) (undo-tree-id619 . -15) (undo-tree-id620 . -15) (undo-tree-id621 . -15) (undo-tree-id622 . -15) (undo-tree-id623 . -15) (undo-tree-id624 . -15) (undo-tree-id625 . -15) (undo-tree-id626 . -15) (undo-tree-id627 . -15) (undo-tree-id628 . -15) (undo-tree-id629 . -15) (undo-tree-id630 . -15) (undo-tree-id631 . -15) (undo-tree-id632 . -15) (undo-tree-id633 . -15) (undo-tree-id634 . -15) (undo-tree-id635 . -15) (undo-tree-id636 . -15) (undo-tree-id637 . -15) (undo-tree-id638 . -15) (undo-tree-id639 . -15) (undo-tree-id640 . -15) (undo-tree-id641 . -15) (undo-tree-id642 . -15) (undo-tree-id643 . -15) (undo-tree-id644 . -15) (undo-tree-id645 . -15) (undo-tree-id646 . -15) (undo-tree-id647 . -15) (undo-tree-id648 . -15) (undo-tree-id649 . -15) (undo-tree-id650 . -15) (undo-tree-id651 . -15) (undo-tree-id652 . -15) (undo-tree-id653 . -15) (undo-tree-id654 . -15) (undo-tree-id655 . -15) (undo-tree-id656 . -15) (undo-tree-id657 . -15) (undo-tree-id658 . -15) (undo-tree-id659 . -15) (undo-tree-id660 . -15) (undo-tree-id661 . -15) (undo-tree-id662 . -15) (undo-tree-id663 . -15) (undo-tree-id664 . -15) (undo-tree-id665 . -15) (undo-tree-id666 . -15) (undo-tree-id667 . -15) (undo-tree-id668 . -15) (undo-tree-id669 . -15) (undo-tree-id670 . -15) (undo-tree-id671 . -15) (undo-tree-id672 . -15) (undo-tree-id673 . -15) (undo-tree-id674 . -15) (undo-tree-id675 . -15) (undo-tree-id676 . -15) (undo-tree-id677 . -15) (undo-tree-id678 . -15) (undo-tree-id679 . -15) (undo-tree-id680 . -15) (undo-tree-id681 . -15) (undo-tree-id682 . -15) (undo-tree-id683 . -15) (undo-tree-id684 . -15) (undo-tree-id685 . -15) (undo-tree-id686 . -15) (undo-tree-id687 . -15) (undo-tree-id688 . -15) (undo-tree-id689 . -15) (undo-tree-id690 . -15) (undo-tree-id691 . -15) (undo-tree-id692 . -15) (undo-tree-id693 . -15) (undo-tree-id694 . -15) (undo-tree-id695 . -15) (undo-tree-id696 . -15) (undo-tree-id697 . -15) (undo-tree-id698 . -15) (undo-tree-id699 . -15) (undo-tree-id700 . -15) (undo-tree-id701 . -15) (undo-tree-id702 . -15) (undo-tree-id703 . -15) (undo-tree-id704 . -15) (undo-tree-id705 . -15) (undo-tree-id706 . -15) (undo-tree-id707 . -15) (undo-tree-id708 . -15) (undo-tree-id709 . -15) (undo-tree-id710 . -15) (undo-tree-id711 . -15) (undo-tree-id712 . -15) (undo-tree-id713 . -15) (undo-tree-id714 . -15) (undo-tree-id715 . -15) (undo-tree-id716 . -15) (undo-tree-id717 . -15) (undo-tree-id718 . -15) (undo-tree-id719 . -15) (undo-tree-id720 . -15) (undo-tree-id721 . -15) (undo-tree-id722 . -15) (undo-tree-id723 . -15) (undo-tree-id724 . -15) (undo-tree-id725 . -15) (undo-tree-id726 . -15) (undo-tree-id727 . -15) (undo-tree-id728 . -15) (undo-tree-id729 . -15) (undo-tree-id730 . -15) (undo-tree-id731 . -15) (undo-tree-id732 . -15) (undo-tree-id733 . -15) (undo-tree-id734 . -15) (undo-tree-id735 . -15) (undo-tree-id736 . -15) (undo-tree-id737 . -15) (undo-tree-id738 . -15) (undo-tree-id739 . -15) (undo-tree-id740 . -15) (undo-tree-id741 . -15) (undo-tree-id742 . -15) (undo-tree-id743 . -15) (undo-tree-id744 . -15) (undo-tree-id745 . -15) (undo-tree-id746 . -15) (undo-tree-id747 . -15) (undo-tree-id748 . -15) (undo-tree-id749 . -15) (undo-tree-id750 . -15) (undo-tree-id751 . -15) (undo-tree-id752 . -15) (undo-tree-id753 . -15) (undo-tree-id754 . -15) (undo-tree-id755 . -5) (undo-tree-id756 . -5) (undo-tree-id757 . -5) (undo-tree-id758 . -5) (undo-tree-id759 . -5) (undo-tree-id760 . -5) (undo-tree-id761 . -5) (undo-tree-id762 . -5) (undo-tree-id763 . -5) (undo-tree-id764 . -5) (undo-tree-id765 . -5) (undo-tree-id766 . -5) (undo-tree-id767 . -5) (undo-tree-id768 . -5) (undo-tree-id769 . -5) (undo-tree-id770 . -5) (undo-tree-id771 . -5) (undo-tree-id772 . -5) (undo-tree-id773 . -5) (undo-tree-id774 . -5) (undo-tree-id775 . -5) (undo-tree-id776 . -5) (undo-tree-id777 . -16) (undo-tree-id778 . -16) (t 27033 2320 781934 33000)) nil (27033 2343 168837 295000) 0 nil])
248
+ ([nil nil ((1002 . 1201) (#("
249
+ \"client-error\",
250
+ { socket: Socket; event: ErrorEvent }
251
+ >
252
+ | BaseServerEvent<\"client-open\", { socket: Socket; event: WSEvent }>
253
+ | BaseServerEvent<
254
+ \"client-close\",
255
+ { socket: Socket; event: CloseEvent }
256
+ " 0 7 (part-side typescript invisible nil) 7 8 (font-lock-face web-mode-part-string-face syntax-table (15) part-token string part-side typescript invisible nil) 8 20 (font-lock-face web-mode-part-string-face part-token string part-side typescript invisible nil) 20 21 (font-lock-face web-mode-part-string-face syntax-table (15) part-token string part-side typescript invisible nil) 21 31 (part-side typescript invisible nil) 31 37 (face web-mode-variable-name-face part-side typescript invisible nil) 37 47 (part-side typescript invisible nil) 47 52 (face web-mode-variable-name-face part-side typescript invisible nil) 52 54 (part-side typescript invisible nil) 54 64 (part-side typescript) 64 67 (part-side typescript invisible nil) 67 93 (part-side typescript invisible nil) 93 94 (font-lock-face web-mode-part-string-face syntax-table (15) part-token string part-side typescript invisible nil) 94 105 (font-lock-face web-mode-part-string-face part-token string part-side typescript invisible nil) 105 106 (font-lock-face web-mode-part-string-face syntax-table (15) part-token string part-side typescript invisible nil) 106 110 (part-side typescript invisible nil) 110 116 (face web-mode-variable-name-face part-side typescript invisible nil) 116 126 (part-side typescript invisible nil) 126 131 (face web-mode-variable-name-face part-side typescript invisible nil) 131 171 (part-side typescript invisible nil) 171 172 (font-lock-face web-mode-part-string-face syntax-table (15) part-token string part-side typescript invisible nil) 172 184 (font-lock-face web-mode-part-string-face part-token string part-side typescript invisible nil) 184 185 (font-lock-face web-mode-part-string-face syntax-table (15) part-token string part-side typescript invisible nil) 185 195 (part-side typescript invisible nil) 195 201 (face web-mode-variable-name-face part-side typescript invisible nil) 201 211 (part-side typescript invisible nil) 211 216 (face web-mode-variable-name-face part-side typescript invisible nil) 216 218 (part-side typescript invisible nil) 218 228 (part-side typescript) 228 231 (part-side typescript invisible nil) 231 235 (part-side typescript invisible nil)) . 1002) (undo-tree-id42 . 94) (undo-tree-id43 . -218) (undo-tree-id44 . -133) (undo-tree-id45 . -140) (t 27033 2343 169717 98000)) nil (27033 57096 405240 299000) 0 nil])
257
+ ([nil nil ((#("socket: Socket" 0 6 (face web-mode-variable-name-face part-side typescript invisible nil) 6 14 (part-side typescript invisible nil)) . 745) (undo-tree-id37 . -13) (undo-tree-id38 . -13) (undo-tree-id39 . -13) (undo-tree-id40 . -13) (undo-tree-id41 . -13) 758 (t 27033 2345 633693 280000)) nil (27033 57096 405237 365000) 0 nil])
258
+ ([nil nil ((297 . 340) (757 . 757) (757 . 767) (#("Conne" 0 5 (part-side typescript)) . 757) (757 . 762) (#("Connection" 0 10 (part-side typescript invisible nil)) . -757) (undo-tree-id29 . -10) (undo-tree-id30 . -10) (undo-tree-id31 . -10) (undo-tree-id32 . -10) 767 (762 . 767) (#("e" 0 1 (part-side typescript invisible nil)) . -762) (undo-tree-id33 . -1) (undo-tree-id34 . -1) (undo-tree-id35 . -1) (undo-tree-id36 . -1) 763 (745 . 763)) nil (27033 57096 405235 176000) 0 nil])
259
+ ([nil nil ((1002 . 1003) (1107 . 1108) (1188 . 1189) (1267 . 1268) (1351 . 1352) (902 . 903) (1000 . 1001) (1104 . 1105) (1184 . 1185) (1262 . 1263) (1345 . 1346) (901 . 902) (998 . 999) (1101 . 1102) (1180 . 1181) (1257 . 1258) (1339 . 1340) (900 . 901) (996 . 997) (1098 . 1099) (1176 . 1177) (1252 . 1253) (1333 . 1334) (899 . 900) (994 . 995) (1095 . 1096) (1172 . 1173) (1247 . 1248) (1327 . 1328) (898 . 899) (992 . 993) (1092 . 1093) (1168 . 1169) (1242 . 1243) (1321 . 1322) (897 . 898) (990 . 991) (1089 . 1090) (1164 . 1165) (1237 . 1238) (1315 . 1316) (896 . 897) (988 . 989) (1086 . 1087) (1160 . 1161) (1232 . 1233) (1309 . 1310) (895 . 896) (986 . 987) (1083 . 1084) (1156 . 1157) (1227 . 1228) (1303 . 1304) (894 . 895) (984 . 985) (1080 . 1081) (1152 . 1153) (1222 . 1223) (1297 . 1298) (893 . 894) (#("S" 0 1 (part-side typescript invisible nil)) . 983) (#("S" 0 1 (part-side typescript invisible nil)) . 1080) (#("S" 0 1 (part-side typescript invisible nil)) . 1153) (#("S" 0 1 (part-side typescript invisible nil)) . 1224) (#("S" 0 1 (part-side typescript invisible nil)) . 1300) (#("S" 0 1 (part-side typescript invisible nil)) . -893) (undo-tree-id0 . -1) (undo-tree-id1 . -1) (undo-tree-id2 . -1) (undo-tree-id3 . -1) (#("o" 0 1 (part-side typescript invisible nil)) . 985) (#("o" 0 1 (part-side typescript invisible nil)) . 1083) (#("o" 0 1 (part-side typescript invisible nil)) . 1157) (#("o" 0 1 (part-side typescript invisible nil)) . 1229) (#("o" 0 1 (part-side typescript invisible nil)) . 1306) (#("o" 0 1 (part-side typescript invisible nil)) . -894) (undo-tree-id4 . -1) (undo-tree-id5 . -1) (undo-tree-id6 . -1) (undo-tree-id7 . -1) (#("c" 0 1 (part-side typescript invisible nil)) . 987) (#("c" 0 1 (part-side typescript invisible nil)) . 1086) (#("c" 0 1 (part-side typescript invisible nil)) . 1161) (#("c" 0 1 (part-side typescript invisible nil)) . 1234) (#("c" 0 1 (part-side typescript invisible nil)) . 1312) (#("c" 0 1 (part-side typescript invisible nil)) . -895) (undo-tree-id8 . -1) (undo-tree-id9 . -1) (undo-tree-id10 . -1) (undo-tree-id11 . -1) (#("k" 0 1 (part-side typescript invisible nil)) . 989) (#("k" 0 1 (part-side typescript invisible nil)) . 1089) (#("k" 0 1 (part-side typescript invisible nil)) . 1165) (#("k" 0 1 (part-side typescript invisible nil)) . 1239) (#("k" 0 1 (part-side typescript invisible nil)) . 1318) (#("k" 0 1 (part-side typescript invisible nil)) . -896) (undo-tree-id12 . -1) (undo-tree-id13 . -1) (undo-tree-id14 . -1) (undo-tree-id15 . -1) (#("e" 0 1 (part-side typescript invisible nil)) . 991) (#("e" 0 1 (part-side typescript invisible nil)) . 1092) (#("e" 0 1 (part-side typescript invisible nil)) . 1169) (#("e" 0 1 (part-side typescript invisible nil)) . 1244) (#("e" 0 1 (part-side typescript invisible nil)) . 1324) (#("e" 0 1 (part-side typescript invisible nil)) . -897) (undo-tree-id16 . -1) (undo-tree-id17 . -1) (undo-tree-id18 . -1) (undo-tree-id19 . -1) (#("t" 0 1 (part-side typescript invisible nil)) . 993) (#("t" 0 1 (part-side typescript invisible nil)) . 1095) (#("t" 0 1 (part-side typescript invisible nil)) . 1173) (#("t" 0 1 (part-side typescript invisible nil)) . 1249) (#("t" 0 1 (part-side typescript invisible nil)) . 1330) (#("t" 0 1 (part-side typescript invisible nil)) . -898) (undo-tree-id20 . -1) (undo-tree-id21 . -1) (undo-tree-id22 . -1) 899 (986 . 987) (1087 . 1088) (1164 . 1165) (1239 . 1240) (1319 . 1320) (890 . 891) (984 . 985) (1084 . 1085) (1160 . 1161) (1234 . 1235) (1313 . 1314) (889 . 890) (982 . 983) (1081 . 1082) (1156 . 1157) (1229 . 1230) (1307 . 1308) (888 . 889) (980 . 981) (1078 . 1079) (1152 . 1153) (1224 . 1225) (1301 . 1302) (887 . 888) (978 . 979) (1075 . 1076) (1148 . 1149) (1219 . 1220) (1295 . 1296) (886 . 887) (976 . 977) (1072 . 1073) (1144 . 1145) (1214 . 1215) (1289 . 1290) (885 . 886) (974 . 975) (1069 . 1070) (1140 . 1141) (1209 . 1210) (1283 . 1284) (884 . 885) (972 . 973) (1066 . 1067) (1136 . 1137) (1204 . 1205) (1277 . 1278) (883 . 884) (970 . 971) (1063 . 1064) (1132 . 1133) (1199 . 1200) (1271 . 1272) (882 . 883) (968 . 969) (1060 . 1061) (1128 . 1129) (1194 . 1195) (1265 . 1266) (881 . 882) (#("s" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 967) (#("s" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1060) (#("s" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1129) (#("s" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1196) (#("s" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1268) (#("s" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . -881) (undo-tree-id23 . -1) (#("o" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 969) (#("o" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1063) (#("o" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1133) (#("o" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1201) (#("o" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1274) (#("o" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . -882) (undo-tree-id24 . -1) (#("c" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 971) (#("c" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1066) (#("c" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1137) (#("c" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1206) (#("c" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1280) (#("c" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . -883) (undo-tree-id25 . -1) (#("k" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 973) (#("k" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1069) (#("k" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1141) (#("k" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1211) (#("k" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1286) (#("k" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . -884) (undo-tree-id26 . -1) (#("e" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 975) (#("e" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1072) (#("e" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1145) (#("e" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1216) (#("e" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1292) (#("e" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . -885) (undo-tree-id27 . -1) (#("t" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 977) (#("t" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1075) (#("t" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1149) (#("t" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1221) (#("t" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . 1298) (#("t" 0 1 (face web-mode-variable-name-face part-side typescript invisible nil)) . -886) (undo-tree-id28 . -1) 887) nil (27033 57096 405226 888000) 0 nil])
260
+ ([nil current ((#("import { type Socket } from \"../socket\";
261
+ " 0 6 (face web-mode-keyword-face part-side typescript invisible nil) 6 7 (part-side typescript invisible nil) 7 9 (part-side typescript invisible nil) 9 13 (face web-mode-keyword-face part-side typescript invisible nil) 13 20 (part-side typescript invisible nil) 20 21 (part-side typescript invisible nil) 21 23 (part-side typescript invisible nil) 23 27 (face web-mode-keyword-face part-side typescript invisible nil) 27 28 (part-side typescript invisible nil) 28 29 (font-lock-face web-mode-part-string-face syntax-table (15) part-token string part-side typescript invisible nil) 29 38 (font-lock-face web-mode-part-string-face part-token string part-side typescript invisible nil) 38 39 (font-lock-face web-mode-part-string-face syntax-table (15) part-token string part-side typescript invisible nil) 39 41 (part-side typescript invisible nil)) . 178) (undo-tree-id46 . -40) (undo-tree-id47 . -28) (undo-tree-id48 . -28) (undo-tree-id49 . -28) (undo-tree-id50 . -28) (undo-tree-id51 . -28) (undo-tree-id52 . -28) (undo-tree-id53 . -28) (undo-tree-id54 . -28) (undo-tree-id55 . -28) (undo-tree-id56 . -28) (undo-tree-id57 . -28) (undo-tree-id58 . -39) (undo-tree-id59 . -39) (undo-tree-id60 . -39) (undo-tree-id61 . -39) (undo-tree-id62 . -39) (undo-tree-id63 . -39) (undo-tree-id64 . -39) (undo-tree-id65 . -39) (undo-tree-id66 . -39) (undo-tree-id67 . -39) (undo-tree-id68 . -39) (undo-tree-id69 . -39) (undo-tree-id70 . -39) (undo-tree-id71 . -39) (undo-tree-id72 . -39) (undo-tree-id73 . -39) (undo-tree-id74 . -39) (undo-tree-id75 . -39) (undo-tree-id76 . -39) (undo-tree-id77 . -39) (undo-tree-id78 . -39) (undo-tree-id79 . -39) (undo-tree-id80 . -39) (undo-tree-id81 . -39) (undo-tree-id82 . -39) (undo-tree-id83 . -39) (undo-tree-id84 . -41) 217 (t 27033 57102 124881 280000)) nil (27033 57106 312487 501000) 0 nil])
248
262
  nil
@@ -20,7 +20,7 @@ const main = async () => {
20
20
  console.log(event.headers);
21
21
  } else if (event.type === "client-message") {
22
22
  console.log(serial.toJS(event.message));
23
- event.socket.send({ ok: true, channel: 'foobar' });
23
+ event.connection.socket.send({ ok: true, channel: 'foobar' });
24
24
  }
25
25
  },
26
26
  });
package/src/server/app.ts CHANGED
@@ -5,6 +5,8 @@ import { ServerEvent } from "./events";
5
5
  import { Socket } from "../socket";
6
6
  import { BinaryBuffer, BinaryType, serial } from "binencode";
7
7
  import { Plugin } from "./plugin";
8
+ import { Connection } from "./connection";
9
+ import { v4 } from 'uuid';
8
10
 
9
11
  export type AppConfig = {
10
12
  host: string;
@@ -17,6 +19,7 @@ export class App {
17
19
  server: Server;
18
20
  ps: PubSub<ServerEvent>;
19
21
  plugins: Map<string, Plugin> = new Map();
22
+ connections: Map<string, Connection> = new Map();
20
23
 
21
24
  constructor(cfg: AppConfig) {
22
25
  this.config = cfg;
@@ -24,6 +27,21 @@ export class App {
24
27
  this.ps = pubsub();
25
28
  }
26
29
 
30
+ private addConnection(connection: Connection) {
31
+ if (this.connections.has(connection.id)) {
32
+ console.log(`Connection already exists: ${connection.id}`);
33
+ };
34
+ this.connections.set(connection.id, connection);
35
+ }
36
+
37
+ private removeConnection(id: string) {
38
+ if (!this.connections.has(id)) {
39
+ console.log(`Connection does not exist: ${id}`);
40
+ return;
41
+ }
42
+ this.connections.delete(id);
43
+ }
44
+
27
45
  use(plugin: Plugin) {
28
46
  this.plugins.set(plugin.name, plugin);
29
47
  this.ps.subscribe(async (event) => {
@@ -66,12 +84,15 @@ export class App {
66
84
  });
67
85
  ws.addListener("connection", async (client, req) => {
68
86
  const socket = new Socket(() => client);
87
+ const connection = new Connection(socket, v4());
88
+ this.addConnection(connection);
89
+
69
90
  await this.ps.publishAsync({
70
91
  type: "client-connection",
71
92
  app: this,
72
93
  ws,
73
94
  req,
74
- socket,
95
+ connection,
75
96
  });
76
97
 
77
98
  socket.connection.addEventListener("open", async (ev) => {
@@ -80,7 +101,7 @@ export class App {
80
101
  app: this,
81
102
  ws,
82
103
  event: ev,
83
- socket,
104
+ connection,
84
105
  });
85
106
  });
86
107
 
@@ -90,8 +111,9 @@ export class App {
90
111
  app: this,
91
112
  ws,
92
113
  event: ev,
93
- socket,
114
+ connection,
94
115
  });
116
+ this.removeConnection(connection.id);
95
117
  });
96
118
 
97
119
  socket.connection.addEventListener("error", async (ev) => {
@@ -100,7 +122,7 @@ export class App {
100
122
  app: this,
101
123
  ws,
102
124
  event: ev,
103
- socket,
125
+ connection,
104
126
  });
105
127
  });
106
128
 
@@ -110,7 +132,7 @@ export class App {
110
132
  app: this,
111
133
  ws,
112
134
  req,
113
- socket,
135
+ connection,
114
136
  });
115
137
  });
116
138
 
@@ -120,7 +142,7 @@ export class App {
120
142
  app: this,
121
143
  isBinary,
122
144
  message: data,
123
- socket,
145
+ connection,
124
146
  ws,
125
147
  });
126
148
 
@@ -152,7 +174,7 @@ export class App {
152
174
  type: "client-message",
153
175
  app: this,
154
176
  message: decoded,
155
- socket,
177
+ connection,
156
178
  ws,
157
179
  });
158
180
  });
@@ -5,6 +5,8 @@ import { ServerEvent } from "./events";
5
5
  import { Socket } from "../socket";
6
6
  import { BinaryBuffer, BinaryType, serial } from "binencode";
7
7
  import { Plugin } from "./plugin";
8
+ import { Connection } from "./connection";
9
+ import { v4 } from 'uuid';
8
10
 
9
11
  export type AppConfig = {
10
12
  host: string;
@@ -17,6 +19,7 @@ export class App {
17
19
  server: Server;
18
20
  ps: PubSub<ServerEvent>;
19
21
  plugins: Map<string, Plugin> = new Map();
22
+ connections: Map<string, Connection> = new Map();
20
23
 
21
24
  constructor(cfg: AppConfig) {
22
25
  this.config = cfg;
@@ -24,6 +27,21 @@ export class App {
24
27
  this.ps = pubsub();
25
28
  }
26
29
 
30
+ private addConnection(connection: Connection) {
31
+ if (this.connections.has(connection.id)) {
32
+ console.log(`Connection already exists: ${connection.id}`);
33
+ };
34
+ this.connections.set(connection.id, connection);
35
+ }
36
+
37
+ private removeConnection(id: string) {
38
+ if (!this.connections.has(id)) {
39
+ console.log(`Connection does not exist: ${id}`);
40
+ return;
41
+ }
42
+ this.connections.delete(id);
43
+ }
44
+
27
45
  use(plugin: Plugin) {
28
46
  this.plugins.set(plugin.name, plugin);
29
47
  this.ps.subscribe(async (event) => {
@@ -65,13 +83,16 @@ export class App {
65
83
  });
66
84
  });
67
85
  ws.addListener("connection", async (client, req) => {
68
- const socket = new Socket(client);
86
+ const socket = new Socket(() => client);
87
+ const connection = new Connection(socket, v4());
88
+ this.addConnection(connection);
89
+
69
90
  await this.ps.publishAsync({
70
91
  type: "client-connection",
71
92
  app: this,
72
93
  ws,
73
94
  req,
74
- socket,
95
+ connection,
75
96
  });
76
97
 
77
98
  socket.connection.addEventListener("open", async (ev) => {
@@ -80,7 +101,7 @@ export class App {
80
101
  app: this,
81
102
  ws,
82
103
  event: ev,
83
- socket,
104
+ connection,
84
105
  });
85
106
  });
86
107
 
@@ -90,7 +111,7 @@ export class App {
90
111
  app: this,
91
112
  ws,
92
113
  event: ev,
93
- socket,
114
+ connection,
94
115
  });
95
116
  });
96
117
 
@@ -100,7 +121,7 @@ export class App {
100
121
  app: this,
101
122
  ws,
102
123
  event: ev,
103
- socket,
124
+ connection,
104
125
  });
105
126
  });
106
127
 
@@ -110,7 +131,7 @@ export class App {
110
131
  app: this,
111
132
  ws,
112
133
  req,
113
- socket,
134
+ connection,
114
135
  });
115
136
  });
116
137
 
@@ -120,7 +141,7 @@ export class App {
120
141
  app: this,
121
142
  isBinary,
122
143
  message: data,
123
- socket,
144
+ connection,
124
145
  ws,
125
146
  });
126
147
 
@@ -152,7 +173,7 @@ export class App {
152
173
  type: "client-message",
153
174
  app: this,
154
175
  message: decoded,
155
- socket,
176
+ connection,
156
177
  ws,
157
178
  });
158
179
  });
@@ -0,0 +1,14 @@
1
+ import { Socket } from "../socket";
2
+
3
+ export class Connection {
4
+ socket: Socket;
5
+ id: string;
6
+
7
+ constructor(
8
+ socket: Socket,
9
+ id: string
10
+ ) {
11
+ this.socket = socket;
12
+ this.id = id;
13
+ }
14
+ }
File without changes
@@ -2,8 +2,8 @@ import { type Binary } from "binencode";
2
2
  import { type App } from "./app";
3
3
  import { type WebSocketServer, type RawData } from "ws";
4
4
  import { type IncomingMessage } from "http";
5
- import { type Socket } from "../socket";
6
5
  import { type ErrorEvent, type CloseEvent, type Event as WSEvent } from "ws";
6
+ import { Connection } from "./connection";
7
7
 
8
8
  export type BaseServerEvent<
9
9
  Type extends string,
@@ -25,17 +25,17 @@ export type ServerEvent =
25
25
  >
26
26
  | BaseServerEvent<
27
27
  "client-connection",
28
- { socket: Socket; req: IncomingMessage }
28
+ { connection: Connection; req: IncomingMessage }
29
29
  >
30
- | BaseServerEvent<"client-message", { socket: Socket; message: Binary }>
30
+ | BaseServerEvent<"client-message", { connection: Connection; message: Binary }>
31
31
  | BaseServerEvent<
32
32
  "client-message-raw",
33
- { socket: Socket; message: RawData; isBinary: boolean }
33
+ { connection: Connection; message: RawData; isBinary: boolean }
34
34
  >
35
- | BaseServerEvent<"client-error", { socket: Socket; event: ErrorEvent }>
36
- | BaseServerEvent<"client-open", { socket: Socket; event: WSEvent }>
37
- | BaseServerEvent<"client-close", { socket: Socket; event: CloseEvent }>
38
- | BaseServerEvent<"client-upgrade", { socket: Socket; req: IncomingMessage }>
35
+ | BaseServerEvent<"client-error", { connection: Connection; event: ErrorEvent }>
36
+ | BaseServerEvent<"client-open", { connection: Connection; event: WSEvent }>
37
+ | BaseServerEvent<"client-close", { connection: Connection; event: CloseEvent }>
38
+ | BaseServerEvent<"client-upgrade", { connection: Connection; req: IncomingMessage }>
39
39
  | BaseServerEvent<"server-ready">
40
40
  | BaseServerEvent<"server-error">
41
41
  | BaseServerEvent<"server-close">;
@@ -1,9 +1,10 @@
1
1
  import { type Binary } from "binencode";
2
2
  import { type App } from "./app";
3
- import { type WebSocketServer, type WebSocket, type RawData } from "ws";
3
+ import { type WebSocketServer, type RawData } from "ws";
4
4
  import { type IncomingMessage } from "http";
5
5
  import { type Socket } from "../socket";
6
6
  import { type ErrorEvent, type CloseEvent, type Event as WSEvent } from "ws";
7
+ import { Connection } from "./connection";
7
8
 
8
9
  export type BaseServerEvent<
9
10
  Type extends string,
@@ -25,23 +26,17 @@ export type ServerEvent =
25
26
  >
26
27
  | BaseServerEvent<
27
28
  "client-connection",
28
- { socket: Socket; req: IncomingMessage }
29
+ { connection: Connection; req: IncomingMessage }
29
30
  >
30
- | BaseServerEvent<"client-message", { socket: Socket; message: Binary }>
31
+ | BaseServerEvent<"client-message", { connection: Connection; message: Binary }>
31
32
  | BaseServerEvent<
32
33
  "client-message-raw",
33
- { socket: Socket; message: RawData; isBinary: boolean }
34
+ { connection: Connection; message: RawData; isBinary: boolean }
34
35
  >
35
- | BaseServerEvent<
36
- "client-error",
37
- { socket: Socket; event: ErrorEvent }
38
- >
39
- | BaseServerEvent<"client-open", { socket: Socket; event: WSEvent }>
40
- | BaseServerEvent<
41
- "client-close",
42
- { socket: Socket; event: CloseEvent }
43
- >
44
- | BaseServerEvent<"client-upgrade", { socket: Socket; req: IncomingMessage }>
36
+ | BaseServerEvent<"client-error", { connection: Connection; event: ErrorEvent }>
37
+ | BaseServerEvent<"client-open", { connection: Connection; event: WSEvent }>
38
+ | BaseServerEvent<"client-close", { connection: Connection; event: CloseEvent }>
39
+ | BaseServerEvent<"client-upgrade", { connection: Connection; req: IncomingMessage }>
45
40
  | BaseServerEvent<"server-ready">
46
41
  | BaseServerEvent<"server-error">
47
42
  | BaseServerEvent<"server-close">;
package/src/socket.ts CHANGED
@@ -5,18 +5,26 @@ import { pubsub, type PubSub, onNextTick } from "@derivesome/core";
5
5
 
6
6
  export type WebSocketImplementation = WebSocket | WSWebSocket;
7
7
 
8
- export type SocketConfig = {};
8
+ export type SocketConfig = {
9
+ autoReconnect?: boolean;
10
+ maxRetries?: number;
11
+ retryDelay?: number;
12
+ };
9
13
 
10
14
  export class Socket<
11
15
  Impl extends WebSocketImplementation = WebSocketImplementation,
12
16
  > {
13
17
  connection!: Impl;
14
18
  private factory: () => Impl;
19
+ private cfg: SocketConfig;
15
20
  ps: PubSub<Binary>;
16
21
  private cleanups: Set<() => void> = new Set();
22
+ private retryCount: number = 0;
23
+ private retryTimer: ReturnType<typeof setTimeout> | null = null;
17
24
 
18
- constructor(factory: () => Impl, _cfg: SocketConfig = {}) {
25
+ constructor(factory: () => Impl, cfg: SocketConfig = {}) {
19
26
  this.factory = factory;
27
+ this.cfg = cfg;
20
28
  this.ps = pubsub();
21
29
  this.connect();
22
30
  }
@@ -28,20 +36,16 @@ export class Socket<
28
36
  autoCleanup?: boolean,
29
37
  ): () => void {
30
38
  const con = this.connection;
31
- if (con instanceof WebSocket) {
32
- con.addEventListener(type, listener, options);
33
- const unsub = () => {
34
- try {
35
- con.removeEventListener(type, listener, options);
36
- } catch {}
37
- };
38
- if (autoCleanup !== false) {
39
- this.cleanups.add(unsub);
40
- }
41
- return unsub;
42
- } else {
43
- return () => {};
39
+ con.addEventListener(type, listener as any, options);
40
+ const unsub = () => {
41
+ try {
42
+ con.removeEventListener(type, listener as any, options);
43
+ } catch {}
44
+ };
45
+ if (autoCleanup !== false) {
46
+ this.cleanups.add(unsub);
44
47
  }
48
+ return unsub;
45
49
  }
46
50
 
47
51
  once<K extends keyof WebSocketEventMap>(
@@ -77,6 +81,27 @@ export class Socket<
77
81
  }
78
82
  }
79
83
 
84
+ private cleanup() {
85
+ for (const fn of this.cleanups) {
86
+ fn();
87
+ }
88
+ this.cleanups.clear();
89
+ }
90
+
91
+ private scheduleReconnect() {
92
+ const { maxRetries = Infinity, retryDelay = 1000 } = this.cfg;
93
+ if (this.retryCount >= maxRetries) return;
94
+
95
+ const delay = Math.min(retryDelay * Math.pow(2, this.retryCount), 30_000);
96
+ this.retryCount++;
97
+
98
+ this.retryTimer = setTimeout(() => {
99
+ this.retryTimer = null;
100
+ this.cleanup();
101
+ this.connect();
102
+ }, delay);
103
+ }
104
+
80
105
  private connect() {
81
106
  this.connection = this.factory();
82
107
  this.connection.binaryType = "arraybuffer";
@@ -93,6 +118,16 @@ export class Socket<
93
118
  }
94
119
  }
95
120
  });
121
+
122
+ if (this.cfg.autoReconnect) {
123
+ this.addEventListener("close", () => {
124
+ this.scheduleReconnect();
125
+ });
126
+
127
+ this.addEventListener("open", () => {
128
+ this.retryCount = 0;
129
+ });
130
+ }
96
131
  }
97
132
 
98
133
  sendBinary(data: Binary) {
package/src/socket.ts~ CHANGED
@@ -5,18 +5,26 @@ import { pubsub, type PubSub, onNextTick } from "@derivesome/core";
5
5
 
6
6
  export type WebSocketImplementation = WebSocket | WSWebSocket;
7
7
 
8
- export type SocketConfig = {};
8
+ export type SocketConfig = {
9
+ autoReconnect?: boolean;
10
+ maxRetries?: number;
11
+ retryDelay?: number;
12
+ };
9
13
 
10
14
  export class Socket<
11
15
  Impl extends WebSocketImplementation = WebSocketImplementation,
12
16
  > {
13
17
  connection!: Impl;
14
18
  private factory: () => Impl;
19
+ private cfg: SocketConfig;
15
20
  ps: PubSub<Binary>;
16
21
  private cleanups: Set<() => void> = new Set();
22
+ private retryCount: number = 0;
23
+ private retryTimer: ReturnType<typeof setTimeout> | null = null;
17
24
 
18
- constructor(factory: () => Impl, _cfg: SocketConfig = {}) {
25
+ constructor(factory: () => Impl, cfg: SocketConfig = {}) {
19
26
  this.factory = factory;
27
+ this.cfg = cfg;
20
28
  this.ps = pubsub();
21
29
  this.connect();
22
30
  }
@@ -28,20 +36,16 @@ export class Socket<
28
36
  autoCleanup?: boolean,
29
37
  ): () => void {
30
38
  const con = this.connection;
31
- if (con instanceof WebSocket) {
32
- con.addEventListener(type, listener, options);
33
- const unsub = () => {
34
- try {
35
- con.removeEventListener(type, listener, options);
36
- } catch {}
37
- };
38
- if (autoCleanup !== false) {
39
- this.cleanups.add(unsub);
40
- }
41
- return unsub;
42
- } else {
43
- return () => {};
39
+ con.addEventListener(type, listener as any, options);
40
+ const unsub = () => {
41
+ try {
42
+ con.removeEventListener(type, listener as any, options);
43
+ } catch {}
44
+ };
45
+ if (autoCleanup !== false) {
46
+ this.cleanups.add(unsub);
44
47
  }
48
+ return unsub;
45
49
  }
46
50
 
47
51
  once<K extends keyof WebSocketEventMap>(
@@ -77,6 +81,27 @@ export class Socket<
77
81
  }
78
82
  }
79
83
 
84
+ private cleanup() {
85
+ for (const fn of this.cleanups) {
86
+ fn();
87
+ }
88
+ this.cleanups.clear();
89
+ }
90
+
91
+ private scheduleReconnect() {
92
+ const { maxRetries = Infinity, retryDelay = 1000 } = this.cfg;
93
+ if (this.retryCount >= maxRetries) return;
94
+
95
+ const delay = Math.min(retryDelay * Math.pow(2, this.retryCount), 30_000);
96
+ this.retryCount++;
97
+
98
+ this.retryTimer = setTimeout(() => {
99
+ this.retryTimer = null;
100
+ this.cleanup();
101
+ this.connect();
102
+ }, delay);
103
+ }
104
+
80
105
  private connect() {
81
106
  this.connection = this.factory();
82
107
  this.connection.binaryType = "arraybuffer";
@@ -93,6 +118,16 @@ export class Socket<
93
118
  }
94
119
  }
95
120
  });
121
+
122
+ if (this.cfg.autoReconnect) {
123
+ this.addEventListener("close", () => {
124
+ this.scheduleReconnect();
125
+ });
126
+
127
+ this.addEventListener("open", () => {
128
+ this.retryCount = 0;
129
+ });
130
+ }
96
131
  }
97
132
 
98
133
  sendBinary(data: Binary) {