GithubHelp home page GithubHelp logo

Comments (6)

rajasimon avatar rajasimon commented on July 24, 2024 1

Oh! Not keyword arguments make sense... And currently I having this code and It's working

result = {}
result['content'] = 'This is another message'
Group("chat").send(result)

from channels.

andrewgodwin avatar andrewgodwin commented on July 24, 2024

Well, you need to know the response channel you're sending to - if you're sending from a WebSocket you'll have that as the reply_channel value of the message in the websocket.receive handler.

Here though, you have a HTTP post, so I'm not sure what you're trying to do - you could just return the value in the response?

from channels.

rajasimon avatar rajasimon commented on July 24, 2024

Thanks for the reply.. Ya the response channel is chat only and I tried

def result_submit(request):
    result = {}
    result['World'] = 'Earth'
    Group("chat").send(content=result)
    return HttpResponse('Ok')

And It's throwing below error...

exceptions.TypeError: serverSend() takes at least 2 arguments (1 given)

from channels.

andrewgodwin avatar andrewgodwin commented on July 24, 2024

Ah, you're using a Group, that makes more sense (otherwise you'd need to get the individual response channels across to the view).

Group.send() takes a dict, not keyword arguments, though I'm not sure why you don't get the error it's meant to throw immediately - can you paste the full traceback?

from channels.

lawrence-gandhar avatar lawrence-gandhar commented on July 24, 2024

Hi, can anyone help me to send the message from a view in django to the channels. I am using the following in views. I am a beginner in channels. Help is appreciated.

message = {}
Channel('background-hello').send(message)

from channels.

proofit404 avatar proofit404 commented on July 24, 2024

@lawrence-gandhar Please use Django users mailing list for further questions with the topic about usage.

To solve your current issue please try following:

Channel('background-hello').send(message, immediately=True)

from channels.

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.