GithubHelp home page GithubHelp logo

Posting data from client about libpusher HOT 4 CLOSED

pusher avatar pusher commented on July 24, 2024
Posting data from client

from libpusher.

Comments (4)

syropian avatar syropian commented on July 24, 2024

Also tried this...just for kicks. Getting an error though.

-(IBAction)pushTrackToServer:(id)sender
{

    NSString *trackInfo = [NSString stringWithFormat:@"{\"message\" : \"%@ - %@\"}", [self.sonora track], [self.sonora artist]];
    NSData *songData = [trackInfo dataUsingEncoding:NSUTF8StringEncoding];
    NSLog(@"%@", trackInfo);
    [self.pusher sendEventNamed:@"my_event" data:songData channel:@"test_channel"];

}

I tried it with and without encoding the string with NSData first. When I use NSData I get an error in XCode that says:

Invalid type in JSON write (NSConcreteMutableData)

Without (just sending data as raw NSString), I get an error on my Pusher app debug console that says

Unsupported event received on socket: my_event

from libpusher.

lukeredpath avatar lukeredpath commented on July 24, 2024

Are you trying to send a client event on a public channel? Pusher only supports client events on private/presence channels.

from libpusher.

syropian avatar syropian commented on July 24, 2024

Ah thanks Luke, didn't know that. I don't need the channel to be private so I decided to just send a POST request from my Cocoa app to a PHP file on my server, which then sends an event to the client. So essentially I no longer need the framework for my project but I just wanted to say you did a fantastic job with it. When I played around with receiving events, just for fun it worked great. Keep up the good work!

from libpusher.

lukeredpath avatar lukeredpath commented on July 24, 2024

Thanks, glad you managed to sort this out.

from libpusher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.