Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

feat: add support to multi channels #642

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

vitorvargasdev
Copy link
Contributor

@vitorvargasdev vitorvargasdev commented Apr 18, 2024

Implementing Multi-Channel Support
Previously, only supported a single channel. Now, I'm introducing multi-channel support, allowing clients to define their own channels.
Now, I've implemented multi-channel support, enabling clients to define their own channels. To achieve this, I've created a new class capable of distributing methods for subscribe, unsubscribe, publish, and disconnect.

Before

Previously, when connecting to Realtime, we would receive one channel along with its respective handling methods.

const realtime = Realtime()

realtime.subscribe()
realtime.publish()
realtime.fetchHistory()

After

Now, with the introduction of multi-channel support, we instantiate the Realtime class and then connect to whichever channels are desired. For example:

const realtime = Realtime()

const channel1 = realtime.connect('channel1')
const channel2 = realtime.connect('channel2')
const channel3 = realtime.connect('channel3')

Subsequently, for each respective channel created, we receive the corresponding set of handling methods.

channel1.subscribe()
channel1.publish()
channel1.fetchHistory()
channel1.disconnect()

channel2.subscribe()
channel2.publish()
channel2.fetchHistory()
channel2.disconnect()

channel3.subscribe()
channel3.publish()
channel3.fetchHistory()
channel3.disconnect()

@vitorvargasdev vitorvargasdev changed the base branch from main to lab April 18, 2024 18:04
@vitorvargasdev vitorvargasdev force-pushed the feat/add-support-to-multi-channels branch from e16eee5 to 41de2c8 Compare April 18, 2024 18:06
@vitorvargasdev vitorvargasdev changed the title feat/add support to multi channels feat: add support to multi channels Apr 18, 2024
@vitorvargasdev vitorvargasdev marked this pull request as draft April 18, 2024 18:08
Copy link
Collaborator

@carlossantos74 carlossantos74 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, but we need to improve. There are things you need to do.

  1. Create an enum for the channel state. Initially it can be connecting, connected and disconnected;
  2. Remove the component state type from the channel;
  3. Add the component state to the component;

src/components/realtime/channel.ts Outdated Show resolved Hide resolved
src/components/realtime/channel.ts Outdated Show resolved Hide resolved
src/components/realtime/index.ts Outdated Show resolved Hide resolved
src/components/realtime/index.ts Outdated Show resolved Hide resolved
@vitorvargasdev vitorvargasdev force-pushed the feat/add-support-to-multi-channels branch from 41de2c8 to 9266987 Compare April 19, 2024 22:47
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 19, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 19, 2024
@vitorvargasdev vitorvargasdev force-pushed the feat/add-support-to-multi-channels branch from 9266987 to 3b0da9d Compare April 19, 2024 23:00
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 19, 2024
@vitorvargasdev vitorvargasdev force-pushed the feat/add-support-to-multi-channels branch from 3b0da9d to 55c5f82 Compare April 21, 2024 01:20
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 21, 2024
@vitorvargasdev vitorvargasdev force-pushed the feat/add-support-to-multi-channels branch from 55c5f82 to 1157bf7 Compare April 21, 2024 01:27
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 21, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 21, 2024
@vitorvargasdev vitorvargasdev force-pushed the feat/add-support-to-multi-channels branch 2 times, most recently from 3c151e0 to 1655b24 Compare April 21, 2024 05:58
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 21, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 21, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 21, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 21, 2024
@vitorvargasdev vitorvargasdev force-pushed the feat/add-support-to-multi-channels branch from 1655b24 to bfb293a Compare April 21, 2024 05:59
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 22, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 22, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 22, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 22, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 22, 2024
@github-actions github-actions bot deleted a comment from SuperViz-Dev Apr 22, 2024
@SuperViz-Dev
Copy link
Contributor

Total Coverage: 93.22%

Coverage Report
File Branch Funcs Lines Uncovered Lines
src
   shims.d.ts 100% 100% 100%
src/common
src/common/types
   colors.types.ts 100% 100% 100%
   events.types.ts 100% 100% 100%
   meeting-colors.types.ts 100% 100% 100%
   participant.types.ts 100% 100% 100%
   realtime.types.ts 100% 100% 100%
   sdk-options.types.ts 100% 100% 100%
   stores.types.ts 100% 100% 100%
src/common/utils
   do-request.ts 100% 100% 87.50% 20
   index.ts 100% 100% 100%
   logger.ts 100% 100% 100%
   observable.ts 100% 100% 100%
   observer.ts 100% 100% 100%
   sleep.ts 0% 100% 100% 2
   use-store.ts 75% 100% 100% 30
src/components
   index.ts 100% 75% 100%
   types.ts 100% 100% 100%
src/components/base
   index.ts 100% 100% 100%
src/components/comments
   index.ts 94.44% 93.33% 96.40% 242, 301, 360, 361, 362, 364, 482, 520, 589, 702, 718
   types.ts 100% 100% 100%
src/components/comments/canvas-pin-adapter
   index.ts 54.55% 85.71% 88.09% 202, 249, 249, 249, 249, 250, 251, 254, 254, 255, 258, 328, 329, 331, 331, 331, 333, 333, 334, 336, 337, 340, 342, 391, 392, 393, 412, 423, 434, 438, 451, 472, 497, 517, 518, 529, 530, 531, 532, 533, 533, 533, 533, 533, 535, 535, 536, 536, 536, 536, 540, 542, 543
src/components/comments/html-pin-adapter
   index.ts 91.59% 96.55% 96.35% 277, 278, 279, 336, 363, 470, 471, 492, 493, 495, 495, 497, 498, 500, 500, 500, 500, 502, 503, 718, 719, 720, 797, 798, 799
src/components/form-elements
   index.ts 98.51% 100% 100% 96
   types.ts 100% 100% 100%
src/components/presence-mouse
   index.ts 50% 50% 90% 10, 11
   types.ts 100% 100% 100%
src/components/presence-mouse/canvas
   index.ts 64.71% 77.27% 87.57% 101, 102, 111, 112, 113, 114, 134, 134, 136, 160, 163, 163, 164, 165, 243, 243, 243, 243, 327, 355, 355, 357, 416, 78, 79, 80, 81, 82, 84, 85, 86, 87, 96, 97
src/components/presence-mouse/html
   index.ts 92.45% 96.97% 99.39% 281, 281, 283, 303, 565, 680
src/components/realtime
   channel.ts 73.33% 80% 85.19% 118, 118, 120, 122, 123, 126, 128, 132, 133, 154, 55, 56, 57, 83, 84, 98
   index.ts 100% 100% 96.97% 73
   types.ts 100% 100% 100%
src/components/video
   index.ts 92.59% 98.08% 98.28% 213, 519, 647, 749, 749, 752, 752, 754
src/components/who-is-online
   index.ts 97.26% 100% 100% 430, 430
   types.ts 100% 100% 100%
src/core
   index.ts 80% 57.14% 76.47% 114, 117, 121, 122, 124, 129, 129, 137, 139, 145, 69, 69, 71, 72, 73, 93, 94
src/core/launcher
   index.ts 70% 76% 87.28% 117, 119, 120, 124, 127, 299, 299, 300, 302, 308, 308, 310, 324, 325, 346, 347, 376, 376, 379, 380, 382, 387, 389, 391, 392, 429, 430, 433
src/services
src/services/api
   index.ts 100% 88.24% 88.33% 102, 103, 105, 111, 112, 113, 114
src/services/auth-service
   index.ts 100% 100% 100%
src/services/browser
   index.ts 100% 100% 100%
src/services/config
   index.ts 100% 100% 100%
src/services/connection-status
   index.ts 100% 100% 100%
src/services/event-bus
   index.ts 100% 100% 100%
src/services/frame-brick-layer
   index.ts 100% 100% 100%
src/services/io
   index.ts 100% 83.33% 86.67% 49, 50
src/services/limits
   index.ts 75% 100% 100% 10
src/services/message-bridge
   index.ts 93.33% 100% 100% 80
src/services/realtime
   index.ts 100% 100% 100%
src/services/realtime/ably
   index.ts 64.65% 68.42% 73.64% 100, 1000, 1004, 1004, 1005, 1008, 1010, 1022, 1023, 1033, 1035, 104, 1045, 1047, 1047, 1048, 105, 1051, 177, 240, 250, 360, 362, 363, 373, 374, 375, 426, 427, 428, 429, 430, 430, 431, 432, 444, 446, 456, 458, 460, 462, 462, 462, 462, 463, 465, 482, 483, 493, 494, 504, 546, 547, 660, 660, 661, 664, 666, 666, 666, 667, 669, 674, 674, 676, 676, 676, 709, 84, 841, 842, 843, 844, 846, 849, 850, 851, 853, 854, 856, 856, 856, 857, 858, 860, 861, 862, 866, 866, 867, 870, 88, 887, 888, 889, 896, 897, 901, 918, 918, 92, 920, 921, 922, 953, 953, 954, 959, 960, 963, 966, 966, 967, 968, 970, 971, 972, 975, 979, 979, 981, 982, 986, 986, 986, 986, 988, 988, 988, 990, 998, 998
src/services/realtime/base
   index.ts 100% 100% 100%
src/services/remote-config-service
   index.ts 100% 100% 100%
src/services/slot
   index.ts 43.75% 83.33% 75.68% 44, 61, 80, 80, 80, 80, 82, 82, 83, 84, 85, 88, 91, 91, 91, 91, 92, 93
src/services/stores
   index.ts 100% 100% 100%
src/services/stores/common
   utils.ts 100% 100% 100%
src/services/stores/global
   index.ts 0% 100% 95.24% 14, 15
src/services/stores/subject
   index.ts 100% 100% 100%
src/services/stores/who-is-online
   index.ts 0% 100% 97.92% 25, 26
src/services/video-conference-manager
   index.ts 61.90% 84.21% 93.53% 121, 124, 125, 126, 169, 174, 206, 207, 212, 213, 214, 217, 217, 218, 220, 221, 299, 311, 333, 360, 361, 362, 415, 449, 560, 572, 615, 619, 678
   types.ts 100% 100% 100%

@SuperViz-Dev
Copy link
Contributor

Total Coverage: 97.35%

Coverage Report
File Branch Funcs Lines Uncovered Lines
src
src/web-components
src/web-components/base
   index.ts 75% 100% 83.52% 28, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69
src/web-components/base/styles
   icon-button.style.ts 100% 100% 100%
   index.ts 100% 100% 100%
   sv-hr.style.ts 100% 100% 100%
   typography.style.ts 100% 100% 100%
   variables.style.ts 100% 100% 100%
src/web-components/base/utils
   importStyle.ts 66.67% 100% 100% 3
src/web-components/comments
   comments.ts 88.24% 76.92% 87.80% 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 137, 64, 65, 66, 79, 80, 94, 95, 96, 97, 98, 99
   index.ts 100% 100% 100%
src/web-components/comments/components
   annotation-filter.ts 100% 100% 100%
   annotation-item.ts 100% 96.43% 96.73% 181, 182, 183, 184, 185, 186, 187, 188, 232, 233
   annotation-pin.ts 100% 100% 95.19% 118, 123, 124, 125, 126, 183, 184, 185, 74, 75, 76, 77, 78
   annotation-resolved.ts 100% 100% 100%
   comment-input.ts 100% 96.55% 97.69% 233, 234, 235, 238, 239, 267, 268, 365, 366, 380, 381
   comment-item.ts 100% 90.48% 96.43% 102, 103, 104, 279, 280, 89, 90, 91, 92, 95, 96
   content.ts 96.15% 81.82% 89.15% 108, 109, 39, 40, 43, 44, 45, 51, 52, 53, 67, 78, 79, 80, 81
   delete-comment-modal.ts 100% 100% 100%
   float-button.ts 100% 100% 87.65% 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 50, 51, 55, 56, 72, 81
   index.ts 100% 100% 100%
   mention-list.ts 100% 100% 100%
   topbar.ts 100% 100% 100%
   types.ts 100% 100% 100%
src/web-components/comments/css
   annotation-filter.style.ts 100% 100% 100%
   annotation-item.style.ts 100% 100% 100%
   annotation-pin.style.ts 100% 100% 100%
   annotation-resolved.style.ts 100% 100% 100%
   comment-input.style.ts 100% 100% 100%
   comment-item.style.ts 100% 100% 100%
   comments.style.ts 100% 100% 100%
   content.style.ts 100% 100% 100%
   float-button.style.ts 100% 100% 100%
   index.ts 100% 100% 100%
   mention-list.style.ts 100% 100% 100%
   powered-by.style.ts 100% 100% 100%
   topbar.style.ts 100% 100% 100%
src/web-components/comments/utils
   autocomplete-handler.ts 100% 100% 98.29% 25, 26
   mention-handler.ts 100% 100% 100%
   watermark.ts 100% 100% 86.15% 15, 16, 17, 18, 19, 20, 21, 22, 23
src/web-components/dropdown
   index.style.ts 100% 100% 100%
   index.ts 92.31% 100% 97.67% 156, 157, 158, 159, 160, 161, 189, 223, 260, 83, 86
src/web-components/hello-world
   index.ts 100% 100% 100%
src/web-components/icon
   index.ts 100% 100% 100%
   types.ts 100% 100% 100%
src/web-components/modal
   index.ts 100% 100% 100%
   modal-container.ts 100% 100% 100%
   modal.ts 100% 100% 100%
src/web-components/modal/styles
   index.style.ts 100% 100% 100%
src/web-components/tooltip
   index.style.ts 100% 100% 100%
   index.ts 85.19% 100% 95.15% 109, 110, 111, 112, 114, 115, 116, 117, 152, 156, 221, 222, 223, 224, 88, 90, 91, 92, 94, 95, 96
   types.ts 100% 100% 100%
src/web-components/who-is-online
   index.ts 100% 100% 100%
   who-is-online.ts 89.71% 100% 96.90% 243, 244, 262, 263, 264, 276, 277, 278, 290, 291, 292, 321, 322, 323, 60, 61, 66, 67
src/web-components/who-is-online/components
   dropdown.ts 97.44% 94.74% 97.86% 138, 139, 140, 141, 142, 143, 146
   index.ts 100% 100% 100%
   messages.ts 100% 80% 97.27% 126, 127, 135, 136, 144, 145
   types.ts 100% 100% 100%
src/web-components/who-is-online/css
   dropdown.style.ts 100% 100% 100%
   index.ts 100% 100% 100%
   messages.style.ts 100% 100% 100%
   who-is-online-style.ts 100% 100% 100%

@vitorvargasdev vitorvargasdev marked this pull request as ready for review April 22, 2024 19:05
@carlossantos74 carlossantos74 merged commit 0347191 into lab Apr 23, 2024
4 checks passed
@SuperViz-Dev
Copy link
Contributor

🎉 This PR is included in version 6.1.0-lab.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@SuperViz-Dev
Copy link
Contributor

🎉 This PR is included in version 6.1.0-beta.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@SuperViz-Dev
Copy link
Contributor

🎉 This PR is included in version 6.2.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@SuperViz-Dev
Copy link
Contributor

🎉 This PR is included in version 6.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants