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

Request: Can you please help us with an example with metadata #1

Open
nofelkad opened this issue Oct 2, 2020 · 0 comments
Open

Request: Can you please help us with an example with metadata #1

nofelkad opened this issue Oct 2, 2020 · 0 comments

Comments

@nofelkad
Copy link

nofelkad commented Oct 2, 2020

With an example from seperate-channel branch

Why does it sends metadata every time?

Frame => Stream ID: 1 Type: REQUEST_CHANNEL Flags: 0b100000000 Length: 43
Metadata:
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 11 67 72 65 65 74 69 6e 67 73 2d 63 68 61 6e 6e |.greetings-chann|
|00000010| 65 6c                                           |el              |
+--------+-------------------------------------------------+----------------+
Data:
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 7b 22 64 61 74 61 22 3a 22 61 22 7d             |{"data":"a"}    |
+--------+-------------------------------------------------+----------------+


Frame => Stream ID: 1 Type: NEXT Flags: 0b100100000 Length: 39
Metadata:
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 11 67 72 65 65 74 69 6e 67 73 2d 63 68 61 6e 6e |.greetings-chann|
|00000010| 65 6c                                           |el              |
+--------+-------------------------------------------------+----------------+
Data:
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 7b 22 64 61 74 61 22 3a 22 62 22 7d             |{"data":"b"}    |
+--------+-------------------------------------------------+----------------+

Below Snippet i tried doesn't work

let payload={
      data: clientRequests,
       metadata: String.fromCharCode('greetings-channel'.length) + 'greetings-channel'
}

 socket
       .requestChannel(Flowable.just({
              data: clientRequests,
              metadata: String.fromCharCode('greetings-channel'.length) + 'greetings-channel',
        }))
         .subscribe({
               onComplete: () => console.log('Request-channel completed'),
               onError: (error => console.error(`Request-channel error:${error.message}`)),
               onNext: (value => console.log(value.data)),
               onSubscribe: (sub => sub.request(10)),
          });

It takes Data all in one

Frame => Stream ID: 1 Type: REQUEST_CHANNEL Flags: 0b100000000 Length: 110
Metadata:
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 11 67 72 65 65 74 69 6e 67 73 2d 63 68 61 6e 6e |.greetings-chann|
|00000010| 65 6c                                           |el              |
+--------+-------------------------------------------------+----------------+
Data:
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 5b 7b 22 64 61 74 61 22 3a 22 61 22 7d 2c 7b 22 |[{"data":"a"},{"|
|00000010| 64 61 74 61 22 3a 22 62 22 7d 2c 7b 22 64 61 74 |data":"b"},{"dat|
|00000020| 61 22 3a 22 63 22 7d 2c 7b 22 64 61 74 61 22 3a |a":"c"},{"data":|
|00000030| 22 64 22 7d 2c 7b 22 64 61 74 61 22 3a 22 65 22 |"d"},{"data":"e"|
|00000040| 7d 2c 7b 22 64 61 74 61 22 3a 22 66 22 7d 5d    |},{"data":"f"}] |
+--------+-------------------------------------------------+----------------+
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

No branches or pull requests

1 participant