Agora Flexible classroom - how to handle exit classroom event? - agora.io

Using flexible class room by following the steps provided at https://docs.agora.io/en/agora-class/agora_class_quickstart_web?platform=Web, I need to handle the event when a user exits a class. Unable to identify the exit class event. It would be nice if anyone can help me out on this.

If you are using the Classroom SDK API Reference then it should work if you have followed all the steps from the documentation.
If you are following the Server Side RESTful API Reference then you can use the following API.
Endpoint: /{region}/edu/apps/{appId}/v2/rooms/{roomUUid}/users/{userUuid}/exit
Method: POST
Let me know in the comment if this is not what you were implementing or any error logs you are facing.

On AgoraEduSDK.launch, there is a listener option that shows both events on room entering and exit
...
listener: (evt) => {
console.log('evtName', evt)
},
...

Related

Kotlin for Volley, how can I check the JSON request for newer data in the API?

I'm working on an app that gets a list of documents/source URL from an api. I'd like to periodically check for new or updated contents within that API so users can update saved items in the database. I'm at a loss on the correct wording to search, thus Google and Stack Overflow have both failed me. My fetching function is below:
The URL for the API is https://api.afiexplorer.com
private fun fetchPubs() {
_binding.contentMain.loading.visibility = View.VISIBLE
request = JsonArrayRequest(
Request.Method.GET,
Config.BASE_URL,
JSONArray(),{ response ->
val items: List<Pubs> =
Gson().fromJson(response.toString(), object : TypeToken<List<Pubs>>() {}.type)
val sortedItems = items.sortedWith(compareBy { it.Number })
pubsList?.clear()
pubsList?.addAll(sortedItems)
// Hardcoded pubs moved to Publications Gitlab Repo
// https://gitlab.com/afi-explorer/pubs
_binding.contentMain.recyclerView.recycledViewPool.clear()
adapter?.notifyDataSetChanged()
_binding.contentMain.loading.visibility = View.GONE
setupData()
Log.i("LENGTH OF DATA", "${items.size}")
},
{error ->
println(error.printStackTrace())
Toasty.error(applicationContext, getString(string.no_internet), Toast.LENGTH_SHORT, true).show()
}
)
MyApplication.instance.addToRequestQueue(request!!)
}
private fun setupData(){
adapter = MainAdapter(applicationContext, pubsList!!, this)
_binding.contentMain.recyclerView.adapter = adapter
}
I tried using ChatGPT to see if that would get me started and that failed miserably. Also searched Google, Reddit and Stack Overflow for similar projects, but mine is a unique scenario I guess. I'm just a hobbyist and intermediate dev I guess. First time working with Volley, everything works, but I would like to find a way to send a notification (preferably not Firebase) if there is updated info within the API listed above. I'm not sure if this is actually doable.
Are you asking if you can somehow find if the remote API has changed its content? If so, how would that service advise you? If the service provider provides a web hook or similar callback you could write a server-based program to send a push notification to your Android app.
Perhaps you intent to poll the API periodically, and then you want to know if there is a change?
If you use a tool such as Postman or curl to easily see the headers of the API https://api.afiexplorer.com you will see, unfortunately, there is no Last-Modified header or ETag header which would allow you to easily determine if there was a change.
Next looking at the content of the API, the author does not provide an obvious version/change date, so no luck there.
What you could do is receive the content as a String, and perform a checksum operation on it, and if it differs you know there has been a change
or if you are deserialising the received JSON in Kotlin data classes, then out of the box, Kotlin will enable you to perform an equality operation on a previous copy of the data to know if there was a change.
This looks like an android app; if so, why don't you create a background service that makes requests to the API and updates the data as needed? You can use an AlarmManager class to set the interval threshold for polling by using the setInexactRepeating() method.
Most apps are updated in this fashion; sometimes, a separate table is created to catalog changesets.
Let me know if this helps.

what is alternative for AuthActions.LOAD_USER_TOKEN_FAIL in sparatcus v3.x

I am using AuthActions.LOAD_USER_TOKEN_FAIL
action for 2.0 but when I migrate to 3.3.0 I am getting error on this as this has been removed.
can you please let me know what is the alternative for this one if I have to track the HTTP error code like v2.0
thanks in advance.
If you are using the standard "credentials" authentication.
You could extend the OOTB AuthService and overirde the loginWithCredentials, keep the same logic but add some additional logic in the catch which is called if the login failed.
I you don't want to add the logic there directly you could create your own LOAD_USER_TOKEN_FAIL and dispatch it from there. Alternatively, you can use the built in Event mechanism to create a new event an observe it elsewhere in the code.

Slack API remove bot from channel

I'd like to remove a slack bot from a channel using slack's API.
I've tried channels.kick but ofcourse, a bot is not a user so it can't be deleted that way. I haven't found any solutions so far on the interwet or on Slacks API documentation.
You are not correct. You can remove a bot user from a public channel or private channel using API methods just fine. I just tested it on a private channel to confirm.
So there must be another reason why this does not work for you. Please check if any of these reasons below apply to your case. Also, please provide the error message you are getting from the API, as that would greatly help to identify the reason.
Here are some potential reasons why kicking a bot user might not work for you:
wrong method: channels.kick only works for public channel, use groups.kick for private channels.
wrong token: bot tokens can not use the kick methods. You need to use a user access token to invoke that API method. (you would get the user_is_bot error)
trying to remove oneself: a user can not kick himself. (you would get the cant_kick_self error)
not using channel IDs: the kick methods require you to provide a channel ID, the name will not work. (you would get the channel_not_found error)
Based on your question I would assume you are getting the user_is_bot error, which let you to assume (incorrectly) that you can't kick a bot. In that case the solution would be to use a user token (not a bot token) to execute the method.

MVC Push notification from server to client side

This question may sound lame but.
Is there any technique to send push notificaiton from server to client side, regarding the server status.
For Example:
While Login
Notification in Client Side in sequence:
Validating User ...
Validating Digital Certificate ...
Sorting downloadable file ...
Preparing to download ...
If its not possible, then is there any alternative elegant way to achieve this.
Thanks
You can use SignalR :
$.connection.hub.start().done(function () {
$('#sendmessage').click(function () {
// Call the Send method on the hub.
chat.server.send($('#displayname').val(), $('#message').val());
// Clear text box and reset focus for next comment.
$('#message').val('').focus();
});
});
use more info: tutorial
you can use signalR here i am providing link have a look on it.
http://www.asp.net/signalr

Following the Laravel basic login: please explain a listener

I was trying to follow basic auth for laravel and get how it generally works but am stuck in one area:
call basic login: https://github.com/illuminate/auth/blob/master/Guard.php#L283
attempt basic login: https://github.com/illuminate/auth/blob/master/Guard.php#L316
attempt to login users with given credentials:
https://github.com/illuminate/auth/blob/master/Guard.php#L355
fire attempt:
https://github.com/illuminate/auth/blob/master/Guard.php#L394
the $this->events variable is a object that follows the dispatcher interface. Here's the fire method signature + description:
https://github.com/illuminate/contracts/blob/master/Events/Dispatcher.php#L40
My question is with the last part: "Fire an event and call the listeners"
So I get that the event is authentication. What listeners are you calling in this context / what are they / what do they do?
You can find a good example on documentation of Laravel 4.2: http://laravel.com/docs/4.2/events (see section Basic Usage -> Subscribing To An Event). In this case you can do something after user do the auth. As you see in an example it's a smart way to update last login date.