About NewSocket

Started by Maximiliano, Feb 20, 2020, 11:34 PM

Previous topic - Next topic

Maximiliano

Hello, good morning, I have a question :'v. Could someone explain to me how the NewSocket works, and if an example is possible (that is not related to the IRC).

Is it possible to use NewSocket to use an Web API ? Example: https://api.chucknorris.io/jokes/random .
If is possible, can i use it many times? Or will cause lag?

Excuse my ignorance about it and my bad english XD.

Thanks in advance.

DizzasTeR

Sockets can be used for other stuff than just IRC yes, but you need to basically understand how they work and what to do with the requests and responses, although I never tried it.

Luckshya

#2
I have used sockets for HTTP requests but I had to create sockets everytime to send a request. So I created that simple plugin for that.

Maybe try this: https://forum.vc-mp.org/?topic=7522.0

And you can use JSON parser to parse the json string to squirrel data using some available parser like https://github.com/electricimp/JSONParser

Maximiliano

Quote from: Doom_Kill3R on Feb 21, 2020, 07:34 AMSockets can be used for other stuff than just IRC yes, but you need to basically understand how they work and what to do with the requests and responses, although I never tried it.
Thank you very much for explaining and commenting.

Quote from: Luckshya on Feb 21, 2020, 07:56 AMI have used sockets for HTTP requests but I had to create sockets everytime to send a request. So I created that simple plugin for that.

Maybe try this: https://forum.vc-mp.org/?topic=7522.0

And you can use JSON parser to parse the json string to squirrel data using some available parser like https://github.com/electricimp/JSONParser
I will use your module :D Thank you very much