This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initHubOne$ = createEffect(() => | |
this.actions$.pipe( | |
ofType(SIGNALR_HUB_UNSTARTED), | |
ofHub(hub1), | |
mergeMapHubToAction(({ action, hub }) => { | |
// TODO : init hub 1 | |
}) | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simplified hub creation | |
const dispatchHubCreation = (hub) => this.store.dispatch(createSignalRHub(hub)); | |
const hub1 = {}; // define hubName and url | |
const hub2 = {}; // define hubName and url | |
const hub3 = {}; // define hubName and url | |
dispatchHubCreation(hub1); | |
dispatchHubCreation(hub2); | |
dispatchHubCreation(hub3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sendEvent$ = createEffect(() => | |
this.actions$.pipe( | |
ofType(sendEvent), // TODO : create a custom action | |
mergeMap(({ params }) => { | |
const hub = findHub(timeHub); | |
if (!hub) { | |
return of(hubNotFound(timeHub)); | |
} | |
// TODO : send event to the hub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initRealtime$ = createEffect(() => | |
this.actions$.pipe( | |
ofType(SIGNALR_HUB_UNSTARTED), | |
mergeMapHubToAction(({ hub }) => { | |
// TODO : add event listeners | |
const whenEvent$ = hub.on('eventName').pipe( | |
map(x => createAction(x)) | |
); | |
return merge( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
whenDisconnected$ = createReconnectEffect(this.actions$, 10 * 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
store.dispatch(startSignalRHub(hubDefinition)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hubDefinition = { | |
hubName: 'hub name', | |
url: 'https://localhost/path' | |
}; | |
store.dispatch(createSignalRHub(hubDefinition)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NgModule({ | |
..., | |
imports: [ | |
StoreModule.forRoot({ signalr: signalrReducer }), | |
EffectsModule.forRoot([SignalREffects, ...]) | |
], | |
... | |
}) | |
export class AppModule { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<List<User>> SearchUsersAsync(string search, int limit) | |
{ | |
var client = new GraphServiceClient(_msGraphAuthenticationProvider); | |
var users = new List<User>(); | |
var currentReferencesPage = await client.Users | |
.Request() | |
.Top(limit) | |
.Filter($"startsWith(displayName, '{search}') or startswith(mail, '{search}')") | |
.GetAsync(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<User> GetUserProfileAsync() | |
{ | |
var client = new GraphServiceClient(_msGraphAuthenticationProvider); | |
return await client.Me.Request().GetAsync(); | |
} |