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

client.call is not a function #19

Open
UCN0 opened this issue Apr 10, 2020 · 5 comments
Open

client.call is not a function #19

UCN0 opened this issue Apr 10, 2020 · 5 comments

Comments

@UCN0
Copy link

UCN0 commented Apr 10, 2020

I am trying to use the node client with react js and I am getting this error from this line

return client.call({
          wsfunction: "moodle_service_app",
  
     })

It says client.call is not a function. How to fix it? Thanks

@mudrd8mz
Copy link
Owner

How do you get the client ?

@UCN0
Copy link
Author

UCN0 commented Apr 20, 2020

Actually it was a mistake I was calling the client directly. But I would like to know how do I have custom web services as array. Like; Service: ["service1", "sercive2"......]. I want to be able to call a function later from my loaded services on the client, but not only one service. Does client.call( ) call a service? If I don't provide any custom service I receive this error: Unable to initialize the client: Error: authentication failed: Web service is not available. (It doesn't exist or might be disabled.). I would like to provide more than one service. thanks

@mudrd8mz
Copy link
Owner

That's not supported and not usually needed, too. What is your use case? In a typical scenario, the server is configured to expose all the required functions to perform the given task via a client in a single service.

Are you sure you are not interchanging external functions with external services? Why do you need multiple services?

@UCN0
Copy link
Author

UCN0 commented Apr 20, 2020

I organized the functions in services as a json where I can call in an organized way, for example; message_service contains only functions related to messages. course_service contains course related functions.

@mudrd8mz
Copy link
Owner

Aha. Well, if you insist in such a setup, you will need to instantiate multiple clients, too - one for messaging, one for course etc.

But again, I would not encourage for such server-side setup. I think it only overcomplicates things, require the same setup (such as authorised users, IP restrictions etc) be performed multiple times etc.

Also the tokens are generated by Moodle to use particular individual services etc.

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

2 participants