Managed to get a start with APC Channels, connect from a small sample SAPUI5 app and get messages back, so far so good. Exercise now becomes more interesting, I want to do AMC, send a message to my channel for forwarding to other users who run another instance of the same SAPUI5 app and each of these users receiving only their own messages based on the SAP User ID (that can be part of the message). Been through this really good stuff below:
ABAP Channels Part 3: Collaboration Scenario Using ABAP Messaging and ABAP Push Channel
ABAP Push / Messaging Channel and SAPUI5 Demo Application
If I got things right reading these two, I can combine APC and AMC channels and consume messages I send to the AMC by using WebSocket class methods in SAPUI5. What I don't get is how I can redirect the result to another user. I was thinking that maybe this can be done by using dedicated channels per user (as written above, talking about internal application) in the AMC channel list.
a) is the above assumption right?
b) Can this be done?
c) If the above can be done, can I go even further by (I have no idea how to do that) retrieving client browser sessions for the user (in case there are more than one) and send the message only to one of them?
Related
Into ABAP channel collaboration, trying to implement 4 scenarios, all of them using PCP protocol, with the help of some really good posts. First two are as provided by the authors, only changes done are relevant to the conversion of the channel from text to PCP
Websocket call from SAPUI5 client, response from backend
Based on ABAP Push / Messaging Channel and SAPUI5 Demo Application, it works fine
Backend communication
Based on https://blogs.sap.com/2014/03/26/abap-channels-part-2-publish-subscribe-messaging-using-abap-messaging-channels/, works fine as well
Here's the AMC channel configuration with both scenarios working (class for scenario 1, reports for scenario 2):
Having the first two working, tried combining them
Message via websocket from the client, delivery to SAP session
Worked just fine (I sent the message from SAPUI5 client and it was received by the GUI backend session), as soon as I removed the APC Channel receiver class, new config below
Message from the backend, delivered to SAPUI5 client (actually, the other 3 served only to reach here)
The idea behind it is removing the report receiver from the authorized programs tab and replacing it again with the APC receiver class, only this time defined as "receive via session", so I can receive the message from the sender report and forward it to the client. Calling SAPUI5 application, connection with APC channel opening as expected, calling backend report, message gets sent correctly by the sender application (sy-subrc = 0, no exception) but seems to go nowhere as a) nothing appears in the client and b) (the most important) break-point inside the on_message method of the APC class is not hit (method not called)
Provided that all other 3 scenarios are working fine, is there something I miss / a specific point that I should have a look or have I understood things completely wrong and scenario 3 works "incidentally"? Scenario 4 AMC configuration below.
Did you bind the Push Channel to the specific APC Channel?
METHOD if_apc_ws_extension~on_start.
TRY.
* bind the WebSocket connection to the AMC channel
DATA(lo_binding) = i_context->get_binding_manager( ).
lo_binding->bind_amc_message_consumer( i_application_id = ‘YAMC_TEST’
i_channel_id = ‘/ping’ ).
CATCH cx_apc_error INTO DATA(lx_apc_error).
DATA(lv_message) = lx_apc_error->get_text( ).
MESSAGE lx_apc_error->get_text( ) TYPE ‘E’.
ENDTRY.
ENDMETHOD.
I'm a PHP developer with a lack of experience on other sever side langages.
I’d like you to give me leads, advice, keywords or whatever that could help me refine my research better.
What I want to do is basically to create a one to one mobile app chat that will scale.
There will be channels of 3 users: User A, User B and the "computer" pushing some messages according to some channels informations like the last time a message has been sent, etc.
User A should know if User B is online, writing, etc.
Every conversation should be stored in a database and would be analyzed by some algorithms. Those algorithms would also analyzed stuffs on user Facebook open graph.
The application should be able to send notification on IOS and Android.
A web administration should allow admin to set some stuff that will define what kind of message would be sent by the "computer".
I'v read lot of posts about websocket, xmpp, node.js, socket.io, etc but I don't have enough knowledge in those areas to decide what architecture should I build to make everything works together. Or maybe there is some cloud base solutions that would fit my needs...
Thanks
As you've stated there are many ways to implement that kind of structure but I am going to write about node.js + socket.io part;
1) It is scalable. You can use cluster, nginx, haproxy. etc. to apply load balancing to your socket.io application (see here) Of course you've to use redis or mongo or some kind of store for socket.io that different servers and processes can communicate each other. (see here)
2) socket.io have rooms. That means clients and any computer bots can join that room to share events with each other. So, in your scenario User A, User B and a computer bot should join to same room and events sent to that room will be broadcasted to every room member. (events can vary as online, typing, new message, anything) (see here)
3) node.js can send push notifications both for iOS and Android.
4) You can write every message to database of your choice on new message event.
5) You can create a REST api with Express framework for your Administration page. And you can use passport for authentication and authorization purposes. You can consume the rest api with Jquery or some other frontend framework like React etc.
Meteor is very well suited for something like this and gives you everything you need. There are also open sourced chat systems built with meteor already to get an idea of where you need to go. The more custom route would be to do what #cdagli said.
I am looking for advice/guidance on how to achieve the following:
I have a circuit mounted and connected to an Arduino and I am able to easily retrieve data from it, using Python and the pySerial module. It allows me to determine the value of an analog input over time.
At the moment I am storing that data to a file, with a time stamp and the correspondent value and I would love to hear opinions and thoughts on how I could 'share' this data to a web server and 'play' it live.
Is it possible to 'stream' the values into the dump file and retrieve data from it at the same time through an AJAX request or should I look into event-driven web servers like 'Tornado', 'Twisted'...
I am a bit lost here. Just for the record, I am comfortable with PHP and JavaScript for the final output, I just don't have a clue on how to constantly 'stream' the data I need.
Thanks in advance.
If you don't plan to update the Ardunio device too much then it would make sense to have the Python component continue to collect the data over the serial port and publish it in a way that can easily be consumed by a service which can distribute the information in a more efficient, and probably flexible, manner.
e.g.
read the data from the serial port and publish messages onto a message queue. The message queue can then be read by any other component and the data can then be distributed to other applications/clients.
Make a web call to a server that can process each update and distribute to other applications/clients.
You could use something like Pusher (who I work for) and make a call to the REST API to deliver each message to any connected clients. Whilst this is a good way of distributing your data you will be publishing your data even if no clients are listening so I think you are best to get the data to a component like a web server first.
Assuming you go with 1 or 2, you can then use realtime web solution to distribute the data to any number of clients. You could use Pusher here or you could use a self hosted solution.
So, the data flow as I see it would be:
Ardunio -> small Python app -> Queue (or HTTP request to Web server) -> Realtime Web Technology -> Many clients
I am builing a win application that has user access control against a sql db, all the data is stored in this db as well.
This project is to be installed in one site on 30-40 machines (I mean to say that it's not web, it's all in one place, maximum call it intranet).
I want that while the program is logged on, the logged-in user should be able to chat to the other logged in users.
Any recommended approaches in C# & VB?
I would appreciate any idea, link or tip.
Please share me with your experience
Thanks!
NOTE: The program is in Wpf if it does matter.
Architecturally, it seems like a publisher-subscriber message bus would be a good pattern for you. You would have a centralized server that each client would register with that will distribute notifications from publishers to subscribers.
Each client will register for notification of the client list upon starting. Each client can register interest in being notified when another client publishes a message. Each client would publish messages to the bus to be delivered to any subscribers for that client.
There is a good example of a pub-sub message bus written in WCF in MSDN: WCF ESSENTIALS What You Need To Know About One-Way Calls, Callbacks, And Events. You could get this up and running fairly quickly.
I'm trying to design an application based on the OpenSocial API, and I'm uncertain of how the pubsub apparatus will work. This appears to be analogous to a Unix pipe, or perhaps an RSS feed.
Is a channel persistent across browsers / computers? That is, can I subscribe to channel "x" on browser A and publish to "x" on browser B, and have this data be read in browser A? If not, is there a convenient opensocial method of accomplishing the same thing?
Also: if one gadget subscribes to a channel after data is published, can that data still be read?
Pubsub is an API feature that allows different OpenSocial gadgets to talk to one another while being on the same page in an OpenSocial container.
That means the connection is not persistent, but if for example you have a map gadget, and a gadget with a list of restaurants which both appear in a page, this mechanism can enable the list to stay relevant to the currently shown area of the map.
This would require the two gadgets to agree on a message format and channel ahead of time.