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

Add support for event streaming API #1794

Merged
merged 60 commits into from
Dec 7, 2023
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
f8c4a60
[WIP] Event streaming
jribbink Nov 9, 2023
bc260f6
Add pubsub & fcl.events implementation
jribbink Nov 21, 2023
a3e45be
Renamings and cleanup
jribbink Nov 21, 2023
3ea8feb
General cleanup
jribbink Nov 22, 2023
910ceb4
Switch to event emitters
jribbink Nov 23, 2023
eb11442
Update tests & code to use emitter
jribbink Nov 23, 2023
973460a
Add reconnect mechanism
jribbink Nov 23, 2023
627b32a
Update tests
jribbink Nov 23, 2023
142fd3c
transport http tests
jribbink Nov 23, 2023
c7758c7
More tests
jribbink Nov 24, 2023
4a7a147
add events dependency
jribbink Nov 24, 2023
bf33e97
Fixup tests
jribbink Nov 24, 2023
26c43a3
Add retriable websocket & remove open event
jribbink Nov 24, 2023
056ddef
fixup jsdoc
jribbink Nov 24, 2023
69a060b
Merge branch 'master' into jribbink/event-streaming
jribbink Nov 24, 2023
42fb7fe
Add HTTP Request error
jribbink Nov 24, 2023
cae134c
Fixup test
jribbink Nov 24, 2023
5d50ef3
Revert decode changes, add tests, & fix reconnect
jribbink Nov 25, 2023
4ae5c28
expand test
jribbink Nov 25, 2023
7597483
Fix CI & circular dep
jribbink Nov 25, 2023
36869d0
Fix tests
jribbink Nov 25, 2023
77b90d0
fix tests
jribbink Nov 26, 2023
04062f2
rename heartbeat
jribbink Nov 26, 2023
d90f357
Merge branch 'master' into jribbink/event-streaming
jribbink Nov 28, 2023
f0bad5f
Merge branch 'master' into jribbink/event-streaming
jribbink Nov 28, 2023
e6083c9
Fix types
jribbink Nov 28, 2023
d5db623
fix test
jribbink Nov 28, 2023
7cb71a0
Update events
jribbink Nov 28, 2023
ce67183
Rename dataStream to streamConnection
jribbink Nov 29, 2023
cb2b096
rename test
jribbink Nov 29, 2023
bfab951
rename shared-exports
jribbink Nov 29, 2023
4973540
fix snapshot
jribbink Nov 29, 2023
3d5075e
Remove unrelated diff
jribbink Nov 29, 2023
0cc70db
Make decodeStream conform to StreamConnection interface
jribbink Nov 29, 2023
7420cb6
remove dummy payload
jribbink Nov 29, 2023
b80a75c
restore builderror
jribbink Nov 29, 2023
2a7fa91
Merge branch 'master' into jribbink/event-streaming
jribbink Nov 29, 2023
b19fa19
Address feedback
jribbink Nov 29, 2023
59debea
changesets
jribbink Nov 29, 2023
47a8076
enter prerelease mode & version packages
jribbink Nov 29, 2023
14ce7f5
Add export to FCL
jribbink Dec 4, 2023
10e9f20
Pre-release event-streaming tagged package
jribbink Dec 4, 2023
b2e43f1
Add error for subscribe events in transport-grpc
jribbink Dec 4, 2023
62d9c28
remove un-needed changeset
jribbink Dec 4, 2023
5b39149
Add legacy events subscription for GRPC
jribbink Dec 6, 2023
dc1a4a6
Remove pre changeset
jribbink Dec 6, 2023
59cfc4d
remove pre versions
jribbink Dec 6, 2023
0a8cea5
Merge branch 'master' into jribbink/event-streaming
jribbink Dec 6, 2023
dd0ce4c
remove pre.json
jribbink Dec 6, 2023
c26225f
Revert changelogs
jribbink Dec 6, 2023
04caf11
fix typescript test
jribbink Dec 6, 2023
ee1f6f4
Add react native subscribeEvents export
jribbink Dec 6, 2023
a492359
upgrade node to 18
jribbink Dec 6, 2023
94118ba
Add nx peer dependencies patch
jribbink Dec 6, 2023
d87bdc4
Revert "upgrade node to 18"
jribbink Dec 6, 2023
f61a878
upgrade node to 18
jribbink Dec 6, 2023
3a059fb
remove opt deps
jribbink Dec 6, 2023
830b0a4
add opt dependencies patch
jribbink Dec 6, 2023
1940a64
fix constructResponse
jribbink Dec 6, 2023
6b5b423
Merge branch 'master' into jribbink/event-streaming
jribbink Dec 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix constructResponse
jribbink committed Dec 6, 2023
commit 1940a64aaef7fc303f9ac185707ff57b40b63ed6
8 changes: 4 additions & 4 deletions packages/transport-http/src/connect-subscribe-events.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ type RawSubscribeEventsStream = StreamConnection<{
}
}>

function constructData(ix: any, context: any, data: any) {
function constructData(ix: Interaction, context: any, data: any) {
const response = context.response()
response.tag = ix.tag

@@ -38,7 +38,7 @@ function constructData(ix: any, context: any, data: any) {
return response
}

function constructResponse(ix: any, context: any, stream: any) {
function constructResponse(ix: Interaction, context: any, stream: any) {
const response = context.response()
response.tag = ix.tag

@@ -94,7 +94,7 @@ export async function connectSubscribeEvents(

// Map the connection to a formatted response stream
connection.on("data", (data: any) => {
const responseData = constructData(ix, context, data)
const responseData = constructData(resolvedIx, context, data)
lastBlockHeight = responseData.heartbeat.blockHeight
outputEmitter.emit("data", responseData)
})
@@ -118,5 +118,5 @@ export async function connectSubscribeEvents(
connection.close()
},
}
return constructResponse(ix, context, responseStream)
return constructResponse(resolvedIx, context, responseStream)
}